package addressparsing_test import ( "slices" "testing" "pkg.jfrech.com/brief/internal/addressparsing" ) type CaseFmapSplitByWhitespaceQuotedText struct { S string Zs []string } func CasesFmapSplitByWhitespaceQuotedText() []CaseFmapSplitByWhitespaceQuotedText { return []CaseFmapSplitByWhitespaceQuotedText{ CaseFmapSplitByWhitespaceQuotedText{" ab \"c\\\"d\t\"\t", []string{" ", "ab", " ", "\"c\\\"d\t\"", "\t"}}, CaseFmapSplitByWhitespaceQuotedText{"", []string{}}, CaseFmapSplitByWhitespaceQuotedText{"Ich heiße \"NAME\t!\". Du (...) nicht?", []string{"Ich", " ", "heiße", " ", "\"NAME\t!\"", ".", " ", "Du", " ", "(...)", " ", "nicht?"}}, CaseFmapSplitByWhitespaceQuotedText{"\"\\\"", []string{"\"\\\""}}, CaseFmapSplitByWhitespaceQuotedText{"\"f\"", []string{"\"f\""}}, CaseFmapSplitByWhitespaceQuotedText{"hel\t lo", []string{"hel", "\t ", "lo"}}, CaseFmapSplitByWhitespaceQuotedText{"hello", []string{"hello"}}, } } func TestFmapSplitByWhitespaceQuotedText(t *testing.T) { for j, tc := range CasesFmapSplitByWhitespaceQuotedText() { zs := []string{} addressparsing.FmapSplitByWhitespaceQuotedText(tc.S, func(z string) { zs = append(zs, z) }) if !slices.Equal(zs, tc.Zs) { t.Errorf("CasesFmapSplitByWhitespaceQuotedText()[%d]: addressparsing.FmapSplitByWhitespaceQuotedText(%q)\n == %q\n != %q", j, tc.S, zs, tc.Zs) } } } // type CaseFixUnquotedMarkers struct { //Q bool S string Z string } func CasesFixUnquotedMarkers() []CaseFixUnquotedMarkers { return []CaseFixUnquotedMarkers{ /* CaseFixUnquotedMarkers{false, " ,@", " \",@\""}, CaseFixUnquotedMarkers{false, " ,@\"", " \",@\"\""}, CaseFixUnquotedMarkers{false, " ,@\"; ", " \",@\"\"; "}, CaseFixUnquotedMarkers{false, " ,@\"; \"", " \",@\"\"; \""}, CaseFixUnquotedMarkers{false, " ,@\";", " \",@\"\";"}, CaseFixUnquotedMarkers{false, " ,@example .\t\tcom\r\n", " \",@example\" .\t\tcom\r\n"}, CaseFixUnquotedMarkers{false, " @example .\t\tcom\r\n", " @example .\t\tcom\r\n"}, CaseFixUnquotedMarkers{false, " comma@example .\t\tcom\r\n", " comma@example .\t\tcom\r\n"}, CaseFixUnquotedMarkers{false, " he