Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(model): Assert multiple assertions in a test case softly #8344

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions model/src/test/kotlin/utils/FindingsMatcherTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.ossreviewtoolkit.model.utils

import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.IsolationMode
import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.collections.beEmpty
Expand Down Expand Up @@ -290,27 +291,29 @@ class FindingsMatcherTest : WordSpec() {
}

"associate licenses and exceptions from the same expression" {
associateLicensesWithExceptions(
"MIT OR (GPL-2.0-only AND CC-BY-3.0 AND GCC-exception-2.0)".toSpdx()
) shouldBe "MIT OR (GPL-2.0-only WITH GCC-exception-2.0 AND CC-BY-3.0)".toSpdx()

associateLicensesWithExceptions(
"MIT OR (0BSD AND CC-BY-3.0 AND GCC-exception-2.0)".toSpdx()
) shouldBe "MIT OR (0BSD AND CC-BY-3.0 AND NOASSERTION WITH GCC-exception-2.0)".toSpdx()

associateLicensesWithExceptions(
"(BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0) AND (GPL-2.0-only AND GCC-exception-2.0)"
.toSpdx()
) shouldBe "BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0".toSpdx()

associateLicensesWithExceptions(
"GPL-2.0-only AND GPL-3.0-only AND Bootloader-exception AND Classpath-exception-2.0".toSpdx()
) shouldBe (
"GPL-2.0-only WITH Bootloader-exception AND " +
"GPL-3.0-only WITH Bootloader-exception AND " +
"GPL-2.0-only WITH Classpath-exception-2.0 AND " +
"GPL-3.0-only WITH Classpath-exception-2.0"
).toSpdx()
assertSoftly {
associateLicensesWithExceptions(
"MIT OR (GPL-2.0-only AND CC-BY-3.0 AND GCC-exception-2.0)".toSpdx()
) shouldBe "MIT OR (GPL-2.0-only WITH GCC-exception-2.0 AND CC-BY-3.0)".toSpdx()

associateLicensesWithExceptions(
"MIT OR (0BSD AND CC-BY-3.0 AND GCC-exception-2.0)".toSpdx()
) shouldBe "MIT OR (0BSD AND CC-BY-3.0 AND NOASSERTION WITH GCC-exception-2.0)".toSpdx()

associateLicensesWithExceptions(
@Suppress("MaxLineLength")
"(BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0) AND (GPL-2.0-only AND GCC-exception-2.0)".toSpdx()
) shouldBe "BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0".toSpdx()

associateLicensesWithExceptions(
"GPL-2.0-only AND GPL-3.0-only AND Bootloader-exception AND Classpath-exception-2.0".toSpdx()
) shouldBe (
"GPL-2.0-only WITH Bootloader-exception AND " +
"GPL-3.0-only WITH Bootloader-exception AND " +
"GPL-2.0-only WITH Classpath-exception-2.0 AND " +
"GPL-3.0-only WITH Classpath-exception-2.0"
).toSpdx()
}
}
}
}
Expand Down
Loading