diff --git a/files/filewriter_test.go b/files/filewriter_test.go index 5809aba57..4d2150359 100644 --- a/files/filewriter_test.go +++ b/files/filewriter_test.go @@ -24,20 +24,20 @@ func TestWriteTo(t *testing.T) { } defer os.RemoveAll(tmppath) - path := tmppath + "/output" + path := filepath.Join(tmppath, "output") err = WriteTo(sf, path) if err != nil { t.Fatal(err) } expected := map[string]string{ - ".": "", - "1": "Some text!\n", - "2": "beep", - "3": "", - "4": "boop", - "5": "", - "5/a": "foobar", + ".": "", + "1": "Some text!\n", + "2": "beep", + "3": "", + "4": "boop", + "5": "", + filepath.FromSlash("5/a"): "foobar", } err = filepath.Walk(path, func(cpath string, info os.FileInfo, err error) error { if err != nil { diff --git a/files/filter_test.go b/files/filter_test.go index d33b11429..ad2e48cd9 100644 --- a/files/filter_test.go +++ b/files/filter_test.go @@ -16,6 +16,10 @@ func (m *mockFileInfo) Name() string { return m.name } +func (m *mockFileInfo) Sys() interface{} { + return nil +} + var _ os.FileInfo = &mockFileInfo{} func TestFileFilter(t *testing.T) { diff --git a/files/serialfile_test.go b/files/serialfile_test.go index ee8da3ad3..ae7639691 100644 --- a/files/serialfile_test.go +++ b/files/serialfile_test.go @@ -29,17 +29,17 @@ 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 { @@ -47,9 +47,9 @@ func testSerialFile(t *testing.T, hidden, withIgnoreRules bool) { } 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 { @@ -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(