Skip to content

Commit

Permalink
🐛 fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Nov 11, 2023
1 parent 6ed37b5 commit 0be9c98
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions provider/lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func TestMultilineGrep(t *testing.T) {
name string
filePath string
pattern string
window int
want int
wantErr bool
}{
Expand All @@ -19,26 +20,37 @@ func TestMultilineGrep(t *testing.T) {
filePath: "./testdata/small.xml",
pattern: "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
want: 2,
window: 1,
wantErr: false,
},
{
name: "multi-line simple pattern",
filePath: "./testdata/small.xml",
pattern: "com.fasterxml.jackson.core.*?jackson-core.*",
want: 69,
want: 68,
window: 2,
wantErr: false,
},
{
name: "multi-line complex pattern",
filePath: "./testdata/small.xml",
pattern: "(<groupId>com.fasterxml.jackson.core</groupId>|<artifactId>jackson-core</artifactId>).*?(<artifactId>jackson-core</artifactId>|<groupId>com.fasterxml.jackson.core</groupId>).*",
want: 69,
want: 68,
window: 2,
wantErr: false,
},
{
name: "multi-line complex pattern",
filePath: "./testdata/big.xml",
pattern: "(<groupId>io.konveyor.demo</groupId>|<artifactId>config-utils</artifactId>).*?(<artifactId>config-utils</artifactId>|<groupId>io.konveyor.demo</groupId>).*",
want: 664,
window: 2,
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := MultilineGrep(context.TODO(), 5, tt.filePath, tt.pattern)
got, err := MultilineGrep(context.TODO(), tt.window, tt.filePath, tt.pattern)
if (err != nil) != tt.wantErr {
t.Errorf("MultilineGrep() error = %v, wantErr %v", err, tt.wantErr)
return
Expand Down

0 comments on commit 0be9c98

Please sign in to comment.