(t *testing.T)
| 11 | } |
| 12 | |
| 13 | func TestArrayAppend(t *testing.T) { |
| 14 | tcases := []struct { |
| 15 | input any |
| 16 | out string |
| 17 | }{ |
| 18 | { |
| 19 | input: []byte{1, 2}, |
| 20 | out: `'{1,2}'`, |
| 21 | }, |
| 22 | { |
| 23 | input: []*byte{ptr(byte(1)), ptr(byte(2))}, |
| 24 | out: `'{1,2}'`, |
| 25 | }, |
| 26 | { |
| 27 | input: []int{1, 2}, |
| 28 | out: `'{1,2}'`, |
| 29 | }, |
| 30 | { |
| 31 | input: []*int{ptr(1), ptr(2)}, |
| 32 | out: `'{1,2}'`, |
| 33 | }, |
| 34 | { |
| 35 | input: []string{"foo", "bar"}, |
| 36 | out: `'{"foo","bar"}'`, |
| 37 | }, |
| 38 | { |
| 39 | input: []*string{ptr("foo"), ptr("bar")}, |
| 40 | out: `'{"foo","bar"}'`, |
| 41 | }, |
| 42 | } |
| 43 | |
| 44 | for _, tcase := range tcases { |
| 45 | out, err := Array(tcase.input).AppendQuery(schema.NewQueryGen(New()), []byte{}) |
| 46 | if err != nil { |
| 47 | t.Fatal(err) |
| 48 | } |
| 49 | |
| 50 | if string(out) != tcase.out { |
| 51 | t.Errorf("expected output to be %s, was %s", tcase.out, string(out)) |
| 52 | } |
| 53 | } |
| 54 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…