github.com/mithrandie/csvq@v1.18.1/lib/query/record_test.go (about) 1 package query 2 3 import ( 4 "reflect" 5 "testing" 6 7 "github.com/mithrandie/csvq/lib/value" 8 ) 9 10 func TestMergeRecordSetList(t *testing.T) { 11 list := []RecordSet{ 12 { 13 NewRecord([]value.Primary{value.NewInteger(1), value.NewString("str1")}), 14 NewRecord([]value.Primary{value.NewInteger(2), value.NewString("str2")}), 15 }, 16 { 17 NewRecord([]value.Primary{value.NewInteger(3), value.NewString("str3")}), 18 NewRecord([]value.Primary{value.NewInteger(4), value.NewString("str4")}), 19 }, 20 } 21 expect := RecordSet{ 22 NewRecord([]value.Primary{value.NewInteger(1), value.NewString("str1")}), 23 NewRecord([]value.Primary{value.NewInteger(2), value.NewString("str2")}), 24 NewRecord([]value.Primary{value.NewInteger(3), value.NewString("str3")}), 25 NewRecord([]value.Primary{value.NewInteger(4), value.NewString("str4")}), 26 } 27 28 result := MergeRecordSetList(list) 29 if !reflect.DeepEqual(result, expect) { 30 t.Errorf("result = %s, want %s", result, expect) 31 } 32 }