MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestIsValidSeparator

Function TestIsValidSeparator

sepDector_test.go:93–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestIsValidSeparator(t *testing.T) {
94 sd := sepDetecor{}
95
96 tests := []struct {
97 name string
98 lines []string
99 sep rune
100 expected bool
101 }{
102 {
103 "Valid comma",
104 []string{"a,b,c", "1,2,3"},
105 ',',
106 true,
107 },
108 {
109 "Invalid separator",
110 []string{"a,b,c", "1,2,3"},
111 '|',
112 false,
113 },
114 {
115 "Inconsistent counts",
116 []string{"a,b,c", "1,2"},
117 ',',
118 false,
119 },
120 {
121 "Empty lines",
122 []string{},
123 ',',
124 false,
125 },
126 }
127
128 for _, tt := range tests {
129 t.Run(tt.name, func(t *testing.T) {
130 result := sd.isValidSeparator(tt.lines, tt.sep)
131 if result != tt.expected {
132 t.Errorf("isValidSeparator() = %v, want %v", result, tt.expected)
133 }
134 })
135 }
136}
137
138func TestCountRuneFast(t *testing.T) {
139 tests := []struct {

Callers

nothing calls this directly

Calls 1

isValidSeparatorMethod · 0.95

Tested by

no test coverage detected