Skip to content

Commit

Permalink
tests: neutral file paths for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jan 20, 2025
1 parent 4dfb61b commit a96fcf4
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions pkg/result/processors/exclusion_paths_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package processors

import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -39,51 +40,51 @@ func TestExclusionPaths_Process(t *testing.T) {
desc: "begin with word",
patterns: []string{"^foo"},
issues: []result.Issue{
{RelativePath: "foo.go"},
{RelativePath: "foo/foo.go"},
{RelativePath: "foo/bar.go"},
{RelativePath: "bar/foo.go"},
{RelativePath: "bar/bar.go"},
{RelativePath: filepath.FromSlash("foo.go")},
{RelativePath: filepath.FromSlash("foo/foo.go")},
{RelativePath: filepath.FromSlash("foo/bar.go")},
{RelativePath: filepath.FromSlash("bar/foo.go")},
{RelativePath: filepath.FromSlash("bar/bar.go")},
},
expected: []result.Issue{
{RelativePath: "bar/foo.go"},
{RelativePath: "bar/bar.go"},
{RelativePath: filepath.FromSlash("bar/foo.go")},
{RelativePath: filepath.FromSlash("bar/bar.go")},
},
},
{
desc: "directory begin with word",
patterns: []string{"^foo/"},
issues: []result.Issue{
{RelativePath: "foo.go"},
{RelativePath: "foo/foo.go"},
{RelativePath: "foo/bar.go"},
{RelativePath: "bar/foo.go"},
{RelativePath: "bar/bar.go"},
{RelativePath: filepath.FromSlash("foo.go")},
{RelativePath: filepath.FromSlash("foo/foo.go")},
{RelativePath: filepath.FromSlash("foo/bar.go")},
{RelativePath: filepath.FromSlash("bar/foo.go")},
{RelativePath: filepath.FromSlash("bar/bar.go")},
},
expected: []result.Issue{
{RelativePath: "foo.go"},
{RelativePath: "bar/foo.go"},
{RelativePath: "bar/bar.go"},
{RelativePath: filepath.FromSlash("foo.go")},
{RelativePath: filepath.FromSlash("bar/foo.go")},
{RelativePath: filepath.FromSlash("bar/bar.go")},
},
},
{
desc: "same suffix with unconstrained expression",
patterns: []string{"c/d.go"},
issues: []result.Issue{
{RelativePath: "a/b/c/d.go"},
{RelativePath: "c/d.go"},
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
{RelativePath: filepath.FromSlash("c/d.go")},
},
expected: []result.Issue{},
},
{
desc: "same suffix with constrained expression",
patterns: []string{"^c/d.go"},
issues: []result.Issue{
{RelativePath: "a/b/c/d.go"},
{RelativePath: "c/d.go"},
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
{RelativePath: filepath.FromSlash("c/d.go")},
},
expected: []result.Issue{
{RelativePath: "a/b/c/d.go"},
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
},
},
}
Expand Down

0 comments on commit a96fcf4

Please sign in to comment.