• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package pythonconfig
2
3import (
4	"testing"
5
6	"github.com/bazelbuild/rules_python/gazelle/pythonconfig"
7)
8
9func TestDistributionSanitizing(t *testing.T) {
10	tests := map[string]struct {
11		input string
12		want  string
13	}{
14		"upper case": {input: "DistWithUpperCase", want: "distwithuppercase"},
15		"dashes":     {input: "dist-with-dashes", want: "dist_with_dashes"},
16		"dots":       {input: "dist.with.dots", want: "dist_with_dots"},
17		"mixed":      {input: "To-be.sanitized", want: "to_be_sanitized"},
18	}
19
20	for name, tc := range tests {
21		t.Run(name, func(t *testing.T) {
22			got := pythonconfig.SanitizeDistribution(tc.input)
23			if tc.want != got {
24				t.Fatalf("expected %q, got %q", tc.want, got)
25			}
26		})
27	}
28}
29