Verifies: SYS-REQ-018 [boundary] No key path returns root value.
(t *testing.T)
| 994 | // Verifies: SYS-REQ-018 [boundary] |
| 995 | // No key path returns root value. |
| 996 | func TestGetNoKeyPathReturnsRoot(t *testing.T) { |
| 997 | data := []byte(`{"a":1}`) |
| 998 | val, dt, _, err := Get(data) |
| 999 | if err != nil { |
| 1000 | t.Fatalf("Get(no keys) error = %v", err) |
| 1001 | } |
| 1002 | if dt != Object { |
| 1003 | t.Fatalf("Get(no keys) type = %v, want Object", dt) |
| 1004 | } |
| 1005 | if string(val) != `{"a":1}` { |
| 1006 | t.Fatalf("Get(no keys) value = %q, want %q", string(val), `{"a":1}`) |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | // Verifies: SYS-REQ-019 [boundary] |
| 1011 | // Empty input with key path returns KeyPathNotFoundError. |