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