Skip to content

Commit

Permalink
test(evaluator): Add two concrete OSADL compatibility matrix tests
Browse files Browse the repository at this point in the history
There also are some OSADL-based tests in `EvaluatorTest`, but better
have some explicit test here as well.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Aug 14, 2024
1 parent dfa843c commit f3a96ae
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions evaluator/src/test/kotlin/osadl/CompatibilityMatrixTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,34 @@ package org.ossreviewtoolkit.evaluator.osadl

import io.kotest.assertions.throwables.shouldNotThrow
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe

class CompatibilityMatrixTest : StringSpec({
"Deserializing the matrix succeeds" {
shouldNotThrow<IllegalArgumentException> {
CompatibilityMatrix.releaseDateAndTime
}
}

"An outbound Apache-2.0 license is incompatible with an inbound GPL-2.0-only license" {
val info = CompatibilityMatrix.getCompatibilityInfo("Apache-2.0", "GPL-2.0-only")

with(info) {
compatibility shouldBe Compatibility.NO
explanation shouldBe "Software under a copyleft license such as the GPL-2.0-only license normally cannot " +
"be redistributed under a non-copyleft license such as the Apache-2.0 license, except if it were " +
"explicitly permitted in the licenses."
}
}

// Note: This might change due to the https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4786638 paper.
"An outbound GPL-2.0-only license is incompatible with an inbound Apache-2.0 license" {
val info = CompatibilityMatrix.getCompatibilityInfo("GPL-2.0-only", "Apache-2.0")

with(info) {
compatibility shouldBe Compatibility.NO
explanation shouldBe "Incompatibility of the Apache-2.0 license with the GPL-2.0-only license is " +
"explicitly stated in the GPL-2.0-only license checklist."
}
}
})

0 comments on commit f3a96ae

Please sign in to comment.