Skip to content

Commit

Permalink
remove os specific paths in tests (#105)
Browse files Browse the repository at this point in the history
* remove os specific paths

* add windows ignore tests back in
  • Loading branch information
armanrahman22 authored Jul 30, 2021
1 parent d88cf5d commit 0b0466f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/ignore/ignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ignore

import (
"os"
"runtime"
"path/filepath"
"testing"

"github.com/rs/zerolog"
Expand All @@ -17,15 +17,14 @@ func TestIgnore_Match(t *testing.T) {
i := NewIgnore([]string{"my/files/*"})
assert.NotNil(t, i)

// Test if rules with backslashes match on windows
assert.False(t, i.Match("not/foo"))
assert.True(t, i.Match("my/files/file1"))
assert.False(t, i.Match("my/files"))

if runtime.GOOS == "windows" {
assert.False(t, i.Match(`not\foo`))
assert.True(t, i.Match(`my\files\file1`))
assert.False(t, i.Match(`my\files`))
}
assert.False(t, i.Match(filepath.Join("not", "foo")))
assert.True(t, i.Match(filepath.Join("my", "files", "file1")))
assert.False(t, i.Match(filepath.Join("my", "files")))
}

// Test all default ignore files, except for .git/info/exclude, since
Expand Down

0 comments on commit 0b0466f

Please sign in to comment.