Cleanup: rewrite crosspath.Stem unit test
Use the same style of testing as the other test functions in the file. No functional changes.
This commit is contained in:
parent
580b3e5726
commit
0a97d04741
@ -99,9 +99,18 @@ func TestJoin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStem(t *testing.T) {
|
||||
assert.Equal(t, "", Stem(""))
|
||||
assert.Equal(t, "stem", Stem("stem.txt"))
|
||||
assert.Equal(t, "stem.tar", Stem("stem.tar.gz"))
|
||||
assert.Equal(t, "file", Stem("/path/to/file.txt"))
|
||||
assert.Equal(t, "file", Stem("C:\\path\\to\\file.txt"))
|
||||
tests := []struct {
|
||||
expect, input string
|
||||
}{
|
||||
{"", ""},
|
||||
{"stem", "stem.txt"},
|
||||
{"stem.tar", "stem.tar.gz"},
|
||||
{"file", "/path/to/file.txt"},
|
||||
{"file", "C:\\path\\to\\file.txt"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
assert.Equal(t,
|
||||
test.expect, Stem(test.input),
|
||||
"for input %q", test.input)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user