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

Function TestInt64ArrayScanError

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

Source from the content-addressed store, hash-verified

731}
732
733func TestInt64ArrayScanError(t *testing.T) {
734 for _, tt := range []struct {
735 input, err string
736 }{
737 {``, "unable to parse array"},
738 {`{`, "unable to parse array"},
739 {`{{5},{6}}`, "cannot convert ARRAY[2][1] to Int64Array"},
740 {`{NULL}`, "parsing array element index 0:"},
741 {`{a}`, "parsing array element index 0:"},
742 {`{5,a}`, "parsing array element index 1:"},
743 {`{5,6,a}`, "parsing array element index 2:"},
744 } {
745 arr := Int64Array{5, 5, 5}
746 err := arr.Scan(tt.input)
747
748 if err == nil {
749 t.Fatalf("Expected error for %q, got none", tt.input)
750 }
751 if !strings.Contains(err.Error(), tt.err) {
752 t.Errorf("Expected error to contain %q for %q, got %q", tt.err, tt.input, err)
753 }
754 if !reflect.DeepEqual(arr, Int64Array{5, 5, 5}) {
755 t.Errorf("Expected destination not to change for %q, got %+v", tt.input, arr)
756 }
757 }
758}
759
760func TestInt64ArrayValue(t *testing.T) {
761 result, err := Int64Array(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…