MCPcopy Create free account
hub / github.com/aarondl/sqlboiler / TestParseArrayError

Function TestParseArrayError

types/array_test.go:79–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestParseArrayError(t *testing.T) {
80 for _, tt := range []struct {
81 input, err string
82 }{
83 {``, "expected '{' at offset 0"},
84 {`x`, "expected '{' at offset 0"},
85 {`}`, "expected '{' at offset 0"},
86 {`{`, "expected '}' at offset 1"},
87 {`{{}`, "expected '}' at offset 3"},
88 {`{}}`, "unexpected '}' at offset 2"},
89 {`{,}`, "unexpected ',' at offset 1"},
90 {`{,x}`, "unexpected ',' at offset 1"},
91 {`{x,}`, "unexpected '}' at offset 3"},
92 {`{x,{`, "unexpected '{' at offset 3"},
93 {`{x},`, "unexpected ',' at offset 3"},
94 {`{x}}`, "unexpected '}' at offset 3"},
95 {`{{x}`, "expected '}' at offset 4"},
96 {`{""x}`, "unexpected 'x' at offset 3"},
97 {`{{a},{b,c}}`, "multidimensional arrays must have elements with matching dimensions"},
98 } {
99 _, _, err := parseArray([]byte(tt.input), []byte{','})
100
101 if err == nil {
102 t.Fatalf("Expected error for %q, got none", tt.input)
103 }
104 if !strings.Contains(err.Error(), tt.err) {
105 t.Errorf("Expected error to contain %q for %q, got %q", tt.err, tt.input, err)
106 }
107 }
108}
109
110func TestArrayScanner(t *testing.T) {
111 var s sql.Scanner

Callers

nothing calls this directly

Calls 2

parseArrayFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…