From 0b0466f111cc822714d35693e1455a9eb24da1b6 Mon Sep 17 00:00:00 2001 From: Arman Rahman <8002969+armanrahman22@users.noreply.github.com> Date: Thu, 29 Jul 2021 21:19:29 -0400 Subject: [PATCH] remove os specific paths in tests (#105) * remove os specific paths * add windows ignore tests back in --- pkg/ignore/ignore_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/ignore/ignore_test.go b/pkg/ignore/ignore_test.go index 36d021b5..5df40443 100644 --- a/pkg/ignore/ignore_test.go +++ b/pkg/ignore/ignore_test.go @@ -2,7 +2,7 @@ package ignore import ( "os" - "runtime" + "path/filepath" "testing" "github.com/rs/zerolog" @@ -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