MCPcopy Create free account
hub / github.com/cloudspannerecosystem/spanner-cli / TestDecodeRow

Function TestDecodeRow

decoder_test.go:465–493  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

463}
464
465func TestDecodeRow(t *testing.T) {
466 tests := []struct {
467 desc string
468 values []interface{}
469 want []string
470 }{
471 {
472 desc: "non-null columns",
473 values: []interface{}{"foo", 123},
474 want: []string{"foo", "123"},
475 },
476 {
477 desc: "non-null column and null column",
478 values: []interface{}{"foo", spanner.NullString{StringVal: "", Valid: false}},
479 want: []string{"foo", "NULL"},
480 },
481 }
482 for _, test := range tests {
483 t.Run(test.desc, func(t *testing.T) {
484 got, err := DecodeRow(createRow(t, test.values))
485 if err != nil {
486 t.Error(err)
487 }
488 if !equalStringSlice(got, test.want) {
489 t.Errorf("DecodeRow(%v) = %v, want = %v", test.values, got, test.want)
490 }
491 })
492 }
493}

Callers

nothing calls this directly

Calls 3

DecodeRowFunction · 0.85
createRowFunction · 0.85
equalStringSliceFunction · 0.85

Tested by

no test coverage detected