Skip to content

Commit

Permalink
test invalid regex
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenharrison committed Oct 2, 2024
1 parent 964709a commit a338e7e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions diff/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,16 @@ func TestFilterPathsByExtension(t *testing.T) {
d.GetSummary().Details[diff.PathsDetail])
}

func TestFilterByInvalidRegex(t *testing.T) {
_, err := diff.Get(&diff.Config{MatchPath: "["}, l(t, 1), l(t, 2))
require.EqualError(t, err, "failed to compile filter regex \"[\": error parsing regexp: missing closing ]: `[`")
}

func TestFilterByInvalidInvertedRegex(t *testing.T) {
_, err := diff.Get(&diff.Config{UnmatchPath: "["}, l(t, 1), l(t, 2))
require.EqualError(t, err, "failed to compile filter regex \"[\": error parsing regexp: missing closing ]: `[`")
}

func TestFilterOperationssByExtension(t *testing.T) {
d, err := diff.Get(&diff.Config{FilterExtension: "x-beta"}, l(t, 1), l(t, 3))
require.NoError(t, err)
Expand Down

0 comments on commit a338e7e

Please sign in to comment.