Skip to content

Commit

Permalink
backport of commit ad52076
Browse files Browse the repository at this point in the history
  • Loading branch information
alisdair committed Jun 23, 2022
1 parent e22c499 commit f9ebeb3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions internal/addrs/module_test.go
Expand Up @@ -56,6 +56,31 @@ func TestModuleEqual_false(t *testing.T) {
}
}

func TestModuleString(t *testing.T) {
testCases := map[string]Module{
"": {},
"module.alpha": {
"alpha",
},
"module.alpha.module.beta": {
"alpha",
"beta",
},
"module.alpha.module.beta.module.charlie": {
"alpha",
"beta",
"charlie",
},
}
for str, module := range testCases {
t.Run(str, func(t *testing.T) {
if got, want := module.String(), str; got != want {
t.Errorf("wrong result: got %q, want %q", got, want)
}
})
}
}

func BenchmarkModuleStringShort(b *testing.B) {
module := Module{"a", "b"}
for n := 0; n < b.N; n++ {
Expand Down

0 comments on commit f9ebeb3

Please sign in to comment.