(t *testing.T)
| 714 | } |
| 715 | |
| 716 | func TestBuildSanitizePreservePattern(t *testing.T) { |
| 717 | tests := []struct { |
| 718 | name string |
| 719 | preserve []rune |
| 720 | expected string |
| 721 | }{ |
| 722 | { |
| 723 | name: "no special chars", |
| 724 | expected: "a-z0-9-", |
| 725 | }, |
| 726 | { |
| 727 | name: "dot only", |
| 728 | preserve: []rune{'.'}, |
| 729 | expected: "a-z0-9-.", |
| 730 | }, |
| 731 | { |
| 732 | name: "underscore only", |
| 733 | preserve: []rune{'_'}, |
| 734 | expected: "a-z0-9-_", |
| 735 | }, |
| 736 | { |
| 737 | name: "duplicates and order are canonicalized", |
| 738 | preserve: []rune{'_', '.', '_', '.'}, |
| 739 | expected: "a-z0-9-._", |
| 740 | }, |
| 741 | } |
| 742 | |
| 743 | for _, tt := range tests { |
| 744 | t.Run(tt.name, func(t *testing.T) { |
| 745 | opts := &SanitizeOptions{PreserveSpecialChars: tt.preserve} |
| 746 | assertSanitizeResultWithContext( |
| 747 | t, |
| 748 | "buildSanitizePreservePattern", |
| 749 | fmt.Sprintf("opts=%+v", opts), |
| 750 | buildSanitizePreservePattern(opts), |
| 751 | tt.expected, |
| 752 | ) |
| 753 | }) |
| 754 | } |
| 755 | } |
nothing calls this directly
no test coverage detected