Skip to content

Commit

Permalink
🐛 fix unit 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 14, 2023
1 parent f3e7208 commit 667ff88
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
13 changes: 13 additions & 0 deletions demo-dep-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
- name: org.postgresql.postgresql
version: 42.2.23
type: compile
resolvedIdentifier: 9cb217a3d5b640567ed7c6e8c11f389613c81c4d
extras:
artifactId: postgresql
groupId: org.postgresql
Expand All @@ -356,6 +357,7 @@
version: 3.5.0
type: runtime
indirect: true
resolvedIdentifier: 2f50520c8abea66fbd8d26e481d3aef5c673b510
extras:
artifactId: checker-qual
groupId: org.checkerframework
Expand All @@ -367,6 +369,7 @@
- name: com.oracle.database.jdbc.ojdbc8
version: 21.1.0.0
type: compile
resolvedIdentifier: 50044485aea10afd7defeee8109c5195b4d3cae2
extras:
artifactId: ojdbc8
groupId: com.oracle.database.jdbc
Expand All @@ -378,6 +381,7 @@
- name: ch.qos.logback.logback-classic
version: 1.1.7
type: compile
resolvedIdentifier: 9865cf6994f9ff13fce0bf93f2054ef6c65bb462
extras:
artifactId: logback-classic
groupId: ch.qos.logback
Expand All @@ -390,6 +394,7 @@
version: 1.1.7
type: compile
indirect: true
resolvedIdentifier: 7873092d39ef741575ca91378a6a21c388363ac8
extras:
artifactId: logback-core
groupId: ch.qos.logback
Expand All @@ -401,6 +406,7 @@
- name: org.hibernate.validator.hibernate-validator
version: 6.2.0.Final
type: compile
resolvedIdentifier: d6b0760dfffbf379cedd02f715ff4c9a2e215921
extras:
artifactId: hibernate-validator
groupId: org.hibernate.validator
Expand All @@ -413,6 +419,7 @@
version: 2.0.2
type: compile
indirect: true
resolvedIdentifier: 5eacc6522521f7eacb081f95cee1e231648461e7
extras:
artifactId: jakarta.validation-api
groupId: jakarta.validation
Expand All @@ -425,6 +432,7 @@
version: 1.5.1
type: compile
indirect: true
resolvedIdentifier: 3fe0bed568c62df5e89f4f174c101eab25345b6c
extras:
artifactId: classmate
groupId: com.fasterxml
Expand Down Expand Up @@ -462,6 +470,7 @@
version: 5.4.32.Final
type: compile
indirect: true
resolvedIdentifier: 99a5e10bf455337014c190e141ec631e9ff71663
extras:
artifactId: hibernate-core
groupId: org.hibernate
Expand Down Expand Up @@ -539,6 +548,7 @@
version: 2.3.1
type: compile
indirect: true
resolvedIdentifier: dd6dda9da676a54c5b36ca2806ff95ee017d8738
extras:
artifactId: jaxb-runtime
groupId: org.glassfish.jaxb
Expand Down Expand Up @@ -590,6 +600,7 @@
version: 1.2.15
type: compile
indirect: true
resolvedIdentifier: bb7b7ec0379982b97c62cd17465cb6d9155f68e8
extras:
artifactId: FastInfoset
groupId: com.sun.xml.fastinfoset
Expand Down Expand Up @@ -641,6 +652,7 @@
version: 1.10.22
type: compile
indirect: true
resolvedIdentifier: ef45d7e2cd1c600d279704f492ed5ce2ceb6cdb5
extras:
artifactId: byte-buddy
groupId: net.bytebuddy
Expand All @@ -653,6 +665,7 @@
version: 1.1.1.Final
type: compile
indirect: true
resolvedIdentifier: a8485cab9484dda36e9a8c319e76b5cc18797b58
extras:
artifactId: jboss-transaction-api_1.2_spec
groupId: org.jboss.spec.javax.transaction
Expand Down
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 667ff88

Please sign in to comment.