From 34046a6e487279be0a01437d50048e6ab79b558b Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 12 Jan 2024 14:02:03 +0100 Subject: [PATCH] test(spdx-utils): Add a test for a complex license choice See [1] for context. [1]: https://github.com/oss-review-toolkit/ort/issues/8082#issuecomment-1889088558 Signed-off-by: Sebastian Schuberth --- utils/spdx/src/test/kotlin/SpdxExpressionTest.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt b/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt index 2e51be58341ed..0f07483a2f4fa 100644 --- a/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt +++ b/utils/spdx/src/test/kotlin/SpdxExpressionTest.kt @@ -476,6 +476,13 @@ class SpdxExpressionTest : WordSpec({ spdxExpression.isValidChoice("a AND b AND d".toSpdx()) shouldBe false spdxExpression.isValidChoice("a AND b AND c AND d".toSpdx()) shouldBe false } + + "return true for a simplified choice for a complex expression" { + val license = "(MIT OR GPL-2.0-only) AND (MIT OR BSD-3-Clause OR GPL-1.0-or-later) AND " + + "(MIT OR BSD-3-Clause OR GPL-2.0-only)" + + license.toSpdx().isValidChoice("MIT".toSpdx()) shouldBe true + } } "applyChoice()" should {