Skip to content

Commit

Permalink
chore(common-utils): Consistently use "()" in test names for functions
Browse files Browse the repository at this point in the history
Update some function names in test titles while at it.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed May 24, 2024
1 parent 53752d5 commit 5f31ec6
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions utils/common/src/test/kotlin/ExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ import java.util.Locale
import org.ossreviewtoolkit.utils.test.shouldNotBeNull

class ExtensionsTest : WordSpec({
"ByteArray.toHexString" should {
"ByteArray.toHexString()" should {
"correctly convert a byte array to a string of hexadecimal digits" {
byteArrayOf(0xde.toByte(), 0xad.toByte(), 0xbe.toByte(), 0xef.toByte()).encodeHex() shouldBe "deadbeef"
}
}

"Collection.getDuplicates" should {
"Collection.getDuplicates()" should {
"return no duplicates if there are none" {
emptyList<String>().getDuplicates() should beEmpty()
listOf("no", "dupes", "in", "here").getDuplicates() should beEmpty()
Expand Down Expand Up @@ -87,7 +87,7 @@ class ExtensionsTest : WordSpec({
}
}

"EnumSet.plus" should {
"EnumSet.plus()" should {
"create an empty set if both summands are empty" {
val sum = enumSetOf<DayOfWeek>() + enumSetOf()

Expand All @@ -101,7 +101,7 @@ class ExtensionsTest : WordSpec({
}
}

"File.expandTilde" should {
"File.expandTilde()" should {
"expand the path if the SHELL environment variable is set".config(enabled = Os.env["SHELL"] != null) {
File("~/Desktop").expandTilde() shouldBe Os.userHomeDirectory.resolve("Desktop")
}
Expand All @@ -111,7 +111,7 @@ class ExtensionsTest : WordSpec({
}
}

"File.isSymbolicLink" should {
"File.isSymbolicLink()" should {
val tempDir = tempdir()
val file = tempDir.resolve("file").apply { createNewFile() }
val directory = tempDir.resolve("directory").safeMkdirs()
Expand Down Expand Up @@ -170,7 +170,7 @@ class ExtensionsTest : WordSpec({
}
}

"File.safeMkDirs" should {
"File.safeMkDirs()" should {
"succeed if directory already exists" {
val directory = tempdir()

Expand Down Expand Up @@ -212,7 +212,7 @@ class ExtensionsTest : WordSpec({
}
}

"File.searchUpwardsForSubdirectory" should {
"File.searchUpwardsForSubdirectory()" should {
"find the root Git directory" {
val gitRoot = File(".").searchUpwardsForSubdirectory(".git")

Expand All @@ -222,7 +222,7 @@ class ExtensionsTest : WordSpec({
}
}

"Map.zip" should {
"Map.zip()" should {
val operation = { left: Int?, right: Int? -> (left ?: 0) + (right ?: 0) }

"correctly merge maps" {
Expand Down Expand Up @@ -257,7 +257,7 @@ class ExtensionsTest : WordSpec({
}
}

"Map.zipWithDefault" should {
"Map.zipWithDefault()" should {
val operation = { left: Int, right: Int -> left + right }

"correctly merge maps" {
Expand Down Expand Up @@ -292,7 +292,7 @@ class ExtensionsTest : WordSpec({
}
}

"Map.zipWithCollections" should {
"Map.zipWithCollections()" should {
"correctly merge maps with list values" {
val map = mapOf(
"1" to listOf(1),
Expand Down Expand Up @@ -353,7 +353,7 @@ class ExtensionsTest : WordSpec({
}
}

"String.isValidUri" should {
"String.isValidUri()" should {
"return true for a valid URI" {
"https://github.com/oss-review-toolkit/ort".isValidUri() shouldBe true
}
Expand All @@ -363,7 +363,7 @@ class ExtensionsTest : WordSpec({
}
}

"String.percentEncode" should {
"String.percentEncode()" should {
"encode characters according to RFC 3986" {
val genDelims = listOf(':', '/', '?', '#', '[', ']', '@')
val subDelims = listOf('!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=')
Expand Down Expand Up @@ -398,7 +398,7 @@ class ExtensionsTest : WordSpec({
}
}

"String.replaceCredentialsInUri" should {
"String.replaceCredentialsInUri()" should {
"strip the user name from a string representing a URL" {
"ssh://bot@gerrit.host.com:29418/parent/project".replaceCredentialsInUri() shouldBe
"ssh://gerrit.host.com:29418/parent/project"
Expand Down Expand Up @@ -429,7 +429,7 @@ class ExtensionsTest : WordSpec({
}
}

"String.unquote" should {
"String.unquote()" should {
"remove surrounding quotes" {
"'single'".unquote() shouldBe "single"
"\"double\"".unquote() shouldBe "double"
Expand All @@ -456,7 +456,7 @@ class ExtensionsTest : WordSpec({
}
}

"String.urlencode" should {
"String.fileSystemEncode()" should {
val str = "project: fünky\$name*>nul."

"encode '*'" {
Expand All @@ -479,7 +479,7 @@ class ExtensionsTest : WordSpec({
}
}

"URI.getQueryParameters" should {
"URI.getQueryParameters()" should {
"return the query parameter for a simple query" {
URI("https://oss-review-toolkit.org?key=value").getQueryParameters() shouldBe
mapOf("key" to listOf("value"))
Expand Down Expand Up @@ -507,7 +507,7 @@ class ExtensionsTest : WordSpec({
}
}

"collapseValues" should {
"collapseToRanges()" should {
"not modify a single value" {
val lines = listOf(255)
lines.collapseToRanges() should containExactlyCollection(255 to 255)
Expand Down

0 comments on commit 5f31ec6

Please sign in to comment.