MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestStringSlicesEqual

Function TestStringSlicesEqual

pkg/gosqlx/testing/testing_test.go:561–583  ·  view source on GitHub ↗

Test stringSlicesEqual helper

(t *testing.T)

Source from the content-addressed store, hash-verified

559
560// Test stringSlicesEqual helper
561func TestStringSlicesEqual(t *testing.T) {
562 tests := []struct {
563 name string
564 a []string
565 b []string
566 expected bool
567 }{
568 {"equal slices", []string{"a", "b", "c"}, []string{"a", "b", "c"}, true},
569 {"different length", []string{"a", "b"}, []string{"a", "b", "c"}, false},
570 {"different content", []string{"a", "b", "c"}, []string{"a", "b", "d"}, false},
571 {"empty slices", []string{}, []string{}, true},
572 {"one empty", []string{"a"}, []string{}, false},
573 }
574
575 for _, tt := range tests {
576 t.Run(tt.name, func(t *testing.T) {
577 result := stringSlicesEqual(tt.a, tt.b)
578 if result != tt.expected {
579 t.Errorf("stringSlicesEqual(%v, %v) = %v, want %v", tt.a, tt.b, result, tt.expected)
580 }
581 })
582 }
583}
584
585// Mock testing.T implementation for testing
586type mockTestingT struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
stringSlicesEqualFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected