Skip to content

Commit

Permalink
Merge pull request ipfs/go-ipfs-files#34 from ipfs/web3-bot/sync
Browse files Browse the repository at this point in the history
sync: update CI config files

This commit was moved from ipfs/go-ipfs-files@dffbf27
  • Loading branch information
marten-seemann authored Jul 22, 2021
2 parents 9345abc + 302094f commit 1a66dc4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
16 changes: 8 additions & 8 deletions files/filewriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions files/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
28 changes: 14 additions & 14 deletions files/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 1a66dc4

Please sign in to comment.