From 43360484fc895afa8437ebf47cba46991f373788 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 10 Jan 2024 12:46:36 +0100 Subject: [PATCH] test(ort-utils): Add more Copyright symbol tests Signed-off-by: Sebastian Schuberth --- .../CopyrightStatementsProcessorTest.kt | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/utils/ort/src/test/kotlin/CopyrightStatementsProcessorTest.kt b/utils/ort/src/test/kotlin/CopyrightStatementsProcessorTest.kt index 9ccb431b29734..194d2d9a736e2 100644 --- a/utils/ort/src/test/kotlin/CopyrightStatementsProcessorTest.kt +++ b/utils/ort/src/test/kotlin/CopyrightStatementsProcessorTest.kt @@ -40,7 +40,7 @@ class CopyrightStatementsProcessorTest : WordSpec({ actualResult shouldBe expectedResult } - "group statements with uppercase (C)" { + "group statements with upper-case (C)" { val statements = listOf( "Copyright (C) 2017 The ORT Project Authors", "Copyright (C) 2022 The ORT Project Authors" @@ -52,5 +52,32 @@ class CopyrightStatementsProcessorTest : WordSpec({ actualResult.processedStatements.keys.first() shouldBe "Copyright (C) 2017, 2022 The ORT Project Authors" actualResult.unprocessedStatements should beEmpty() } + + "group statements with lower-case (c)" { + val statements = listOf( + "Copyright (c) 2017 The ORT Project Authors", + "Copyright (c) 2022 The ORT Project Authors" + ) + + val actualResult = CopyrightStatementsProcessor.process(statements) + + actualResult.processedStatements shouldHaveSize 1 + actualResult.processedStatements.keys.first() shouldBe "Copyright (c) 2017, 2022 The ORT Project Authors" + actualResult.unprocessedStatements should beEmpty() + } + + "not group statements with mixed-case (C) and (c)" { + val statements = listOf( + "Copyright (C) 2017 The ORT Project Authors", + "Copyright (c) 2022 The ORT Project Authors" + ) + + val actualResult = CopyrightStatementsProcessor.process(statements) + + actualResult.processedStatements shouldHaveSize 2 + actualResult.processedStatements.keys.first() shouldBe "Copyright (C) 2017 The ORT Project Authors" + actualResult.processedStatements.keys.last() shouldBe "Copyright (c) 2022 The ORT Project Authors" + actualResult.unprocessedStatements should beEmpty() + } } })