MCPcopy Index your code
hub / github.com/aarondl/sqlboiler / TestBytesArrayScanError

Function TestBytesArrayScanError

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

Source from the content-addressed store, hash-verified

424}
425
426func TestBytesArrayScanError(t *testing.T) {
427 for _, tt := range []struct {
428 input, err string
429 }{
430 {``, "unable to parse array"},
431 {`{`, "unable to parse array"},
432 {`{{"\\xfeff"},{"\\xbeef"}}`, "cannot convert ARRAY[2][1] to BytesArray"},
433 {`{"\\abc"}`, "could not parse bytea array index 0: could not parse bytea value"},
434 } {
435 arr := BytesArray{{2}, {6}, {0, 0}}
436 err := arr.Scan(tt.input)
437
438 if err == nil {
439 t.Fatalf("Expected error for %q, got none", tt.input)
440 }
441 if !strings.Contains(err.Error(), tt.err) {
442 t.Errorf("Expected error to contain %q for %q, got %q", tt.err, tt.input, err)
443 }
444 if !reflect.DeepEqual(arr, BytesArray{{2}, {6}, {0, 0}}) {
445 t.Errorf("Expected destination not to change for %q, got %+v", tt.input, arr)
446 }
447 }
448}
449
450func TestBytesArrayValue(t *testing.T) {
451 result, err := BytesArray(nil).Value()

Callers

nothing calls this directly

Calls 2

ScanMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…