Skip to content

Commit

Permalink
test(spdx-utils): Improve names of helper functions
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Nonnenmacher <[email protected]>
  • Loading branch information
mnonnenmacher committed Feb 26, 2024
1 parent 1cda546 commit b776ebb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions utils/spdx/src/test/kotlin/parser/SpdxExpressionParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.ossreviewtoolkit.utils.spdx.SpdxOperator

class SpdxExpressionParserTest : FunSpec({
context("identifiers") {
verifyExceptions(
verifyExpressions(
"a" to SpdxLicenseIdExpression("a"),
"a+" to SpdxLicenseIdExpression("a", orLaterVersion = true),
"a-or-later" to SpdxLicenseIdExpression("a-or-later", orLaterVersion = true),
Expand All @@ -46,15 +46,15 @@ class SpdxExpressionParserTest : FunSpec({
}

context("license references") {
verifyExceptions(
verifyExpressions(
"LicenseRef-a" to SpdxLicenseReferenceExpression("LicenseRef-a"),
"LicenseRef-ort-license" to SpdxLicenseReferenceExpression("LicenseRef-ort-license"),
"DocumentRef-a:LicenseRef-b" to SpdxLicenseReferenceExpression("DocumentRef-a:LicenseRef-b")
)
}

context("WITH expressions") {
verifyExceptions(
verifyExpressions(
"a WITH b" to SpdxLicenseWithExceptionExpression(
SpdxLicenseIdExpression("a"),
"b"
Expand All @@ -67,7 +67,7 @@ class SpdxExpressionParserTest : FunSpec({
}

context("AND expressions") {
verifyExceptions(
verifyExpressions(
"a AND b" to SpdxCompoundExpression(
SpdxOperator.AND,
SpdxLicenseIdExpression("a"),
Expand All @@ -90,7 +90,7 @@ class SpdxExpressionParserTest : FunSpec({
}

context("OR expressions") {
verifyExceptions(
verifyExpressions(
"a OR b" to SpdxCompoundExpression(
SpdxOperator.OR,
SpdxLicenseIdExpression("a"),
Expand All @@ -113,7 +113,7 @@ class SpdxExpressionParserTest : FunSpec({
}

context("compound expressions") {
verifyExceptions(
verifyExpressions(
"(a)" to SpdxLicenseIdExpression("a"),
"(a AND b)" to SpdxCompoundExpression(
SpdxOperator.AND,
Expand Down Expand Up @@ -155,7 +155,7 @@ class SpdxExpressionParserTest : FunSpec({
}

context("operator precedence") {
verifyExceptions(
verifyExpressions(
"a AND b OR c" to SpdxCompoundExpression(
SpdxOperator.OR,
SpdxCompoundExpression(
Expand Down Expand Up @@ -225,7 +225,7 @@ class SpdxExpressionParserTest : FunSpec({
}

context("invalid expressions") {
verifyErrors(
verifyExceptions(
"a a" to SpdxExpressionParserException(Token.IDENTIFIER(3, 3, "a")),
"a AND" to SpdxExpressionParserException(null),
"AND a" to SpdxExpressionParserException(Token.AND(1)),
Expand All @@ -250,7 +250,7 @@ class SpdxExpressionParserTest : FunSpec({
/**
* Verify that the [SpdxExpressionParser] produces the expected [SpdxExpression] for the given input.
*/
private suspend fun FunSpecContainerScope.verifyExceptions(vararg input: Pair<String, SpdxExpression>) {
private suspend fun FunSpecContainerScope.verifyExpressions(vararg input: Pair<String, SpdxExpression>) {
withData(
nameFn = { it.first },
input.asList()
Expand All @@ -262,7 +262,7 @@ private suspend fun FunSpecContainerScope.verifyExceptions(vararg input: Pair<St
/**
* Verify that the [SpdxExpressionParser] produces the expected [SpdxExpressionParserException] for the given input.
*/
private suspend fun FunSpecContainerScope.verifyErrors(vararg input: Pair<String, SpdxExpressionParserException>) {
private suspend fun FunSpecContainerScope.verifyExceptions(vararg input: Pair<String, SpdxExpressionParserException>) {
withData(
nameFn = { it.first },
input.asList()
Expand Down

0 comments on commit b776ebb

Please sign in to comment.