Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Normalize path separator in tests based in OS
Browse files Browse the repository at this point in the history
Use OS specific path separators in tests
  • Loading branch information
masih committed Jul 22, 2021
1 parent 73547d8 commit ed1e0df
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions serialfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ func testSerialFile(t *testing.T, hidden, withIgnoreRules bool) {
defer os.RemoveAll(tmppath)

testInputs := map[string]string{
"1": "Some text!\n",
"2": "beep",
"3": "",
"4": "boop",
"5": "",
"5/a": "foobar",
".6": "thing",
"7": "",
"7/.foo": "bla",
".8": "",
".8/foo": "bla",
"1": "Some text!\n",
"2": "beep",
"3": "",
"4": "boop",
"5": "",
filepath.FromSlash("5/a"): "foobar",
".6": "thing",
"7": "",
filepath.FromSlash("7/.foo"): "bla",
".8": "",
filepath.FromSlash(".8/foo"): "bla",
}
fileFilter, err := NewFilter("", []string{"9", "10"}, hidden)
if err != nil {
t.Fatal(err)
}
if withIgnoreRules {
testInputs["9"] = ""
testInputs["9/b"] = "bebop"
testInputs[filepath.FromSlash("9/b")] = "bebop"
testInputs["10"] = ""
testInputs["10/.c"] = "doowop"
testInputs[filepath.FromSlash("10/.c")] = "doowop"
}

for p, c := range testInputs {
Expand All @@ -76,7 +76,7 @@ func testSerialFile(t *testing.T, hidden, withIgnoreRules bool) {

testInputs:
for p := range testInputs {
components := strings.Split(p, "/")
components := strings.Split(p, string(filepath.Separator))
var stat os.FileInfo
for i := range components {
stat, err = os.Stat(filepath.Join(
Expand Down

0 comments on commit ed1e0df

Please sign in to comment.