(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestArrayParseError(t *testing.T) { |
| 68 | tests := []struct { |
| 69 | in, wantErr string |
| 70 | }{ |
| 71 | {``, "expected '{' at offset 0"}, |
| 72 | {`x`, "expected '{' at offset 0"}, |
| 73 | {`}`, "expected '{' at offset 0"}, |
| 74 | {`{`, "expected '}' at offset 1"}, |
| 75 | {`{{}`, "expected '}' at offset 3"}, |
| 76 | {`{}}`, "unexpected '}' at offset 2"}, |
| 77 | {`{,}`, "unexpected ',' at offset 1"}, |
| 78 | {`{,x}`, "unexpected ',' at offset 1"}, |
| 79 | {`{x,}`, "unexpected '}' at offset 3"}, |
| 80 | {`{x,{`, "unexpected '{' at offset 3"}, |
| 81 | {`{x},`, "unexpected ',' at offset 3"}, |
| 82 | {`{x}}`, "unexpected '}' at offset 3"}, |
| 83 | {`{{x}`, "expected '}' at offset 4"}, |
| 84 | {`{""x}`, "unexpected 'x' at offset 3"}, |
| 85 | {`{{a},{b,c}}`, "multidimensional arrays must have elements with matching dimensions"}, |
| 86 | } |
| 87 | |
| 88 | for _, tt := range tests { |
| 89 | t.Run("", func(t *testing.T) { |
| 90 | _, _, err := parseArray([]byte(tt.in), []byte{','}) |
| 91 | if !pqtest.ErrorContains(err, tt.wantErr) { |
| 92 | t.Errorf("wrong error:\nhave: %s\nwant: %s", err, tt.wantErr) |
| 93 | } |
| 94 | }) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func TestArrayFunc(t *testing.T) { |
| 99 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…