package config_test import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "sneak.berlin/go/dnswatcher/internal/config" ) func TestParseCSV(t *testing.T) { t.Parallel() tests := []struct { name string input string want []string }{ {"empty string", "", nil}, {"single value", "a", []string{"a"}}, {"multiple values", "a,b,c", []string{"a", "b", "c"}}, {"whitespace trimmed", " a , b ", []string{"a", "b"}}, {"trailing comma", "a,b,", []string{"a", "b"}}, {"leading comma", ",a,b", []string{"a", "b"}}, {"consecutive commas", "a,,b", []string{"a", "b"}}, {"all empty segments", ",,,", nil}, {"whitespace only", " , , ", nil}, {"tabs", "\ta\t,\tb\t", []string{"a", "b"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { t.Parallel() got := config.ParseCSVForTest(tt.input) require.Len(t, got, len(tt.want)) for i, w := range tt.want { assert.Equal(t, w, got[i]) } }) } }