Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Nov 9, 2023
1 parent 00209dd commit 7c09089
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions librisworks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ sourceSets {
scripts {
groovy { srcDir 'scripts' }
}
test {
groovy { srcDir 'src/test/groovy/' }
}
}

repositories {
Expand All @@ -13,10 +16,16 @@ repositories {

dependencies {
implementation project(':whelktool')
testImplementation project(':whelk-core')
compileOnly "org.codehaus.groovy:groovy:${groovyVersion}"
compileOnly project(':whelk-core')
scriptsCompileOnly sourceSets.main.output
scriptsCompileOnly project(':whelk-core')
testImplementation "org.spockframework:spock-core:${spockVersion}"
}

test {
useJUnitPlatform()
}

jar {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package se.kb.libris.mergeworks.compare

import spock.lang.Specification

class ClassificationSpec extends Specification {
def "merge SAB codes"() {
expect:
Classification.tryMergeSabCodes(a, b) == result

where:
a || b || result
'H' || 'H' || 'H'
'Haaa' || 'H' || 'Haaa'
'Hcqaa' || 'Hcbqbbb' || 'Hcqaa'
'Hcb' || 'Hc' || null
'Hci' || 'Hci,u' || 'Hci,u'
'Hcd.016' || 'Hcd.01' || 'Hcd.016'
'Hc.01' || 'Hcd.01' || 'Hcd.01'
'Hda.017=c' || 'Hda.018' || 'Hda.017=c'
'He' || 'Hc' || null
}
}

0 comments on commit 7c09089

Please sign in to comment.