diff options
author | Linnea Gräf <nea@nea.moe> | 2024-03-01 10:46:54 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-03-01 10:46:54 +0100 |
commit | f28dee0ef3a0dd4a0819a3d3a1c800a83a0f07f5 (patch) | |
tree | 683e422123e66e218e36c571479fa9bbdce03469 /src/test/kotlin/moe/nea | |
parent | 953ab2f83e2337b10a6c8c7dbbecf45a75ff8b59 (diff) | |
download | firmament-f28dee0ef3a0dd4a0819a3d3a1c800a83a0f07f5.tar.gz firmament-f28dee0ef3a0dd4a0819a3d3a1c800a83a0f07f5.tar.bz2 firmament-f28dee0ef3a0dd4a0819a3d3a1c800a83a0f07f5.zip |
Add more color code tests
[no changelog]
Diffstat (limited to 'src/test/kotlin/moe/nea')
-rw-r--r-- | src/test/kotlin/moe/nea/firmament/test/ColorCode.kt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/kotlin/moe/nea/firmament/test/ColorCode.kt b/src/test/kotlin/moe/nea/firmament/test/ColorCode.kt index 737534e..b8968aa 100644 --- a/src/test/kotlin/moe/nea/firmament/test/ColorCode.kt +++ b/src/test/kotlin/moe/nea/firmament/test/ColorCode.kt @@ -25,4 +25,39 @@ class ColorCode { Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true).toString()) Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true).toString()) } + + @Test + fun testEdging() { + Assertions.assertEquals("", "§".removeColorCodes()) + Assertions.assertEquals("a", "a§".removeColorCodes()) + Assertions.assertEquals("b", "§ab§".removeColorCodes()) + } + + @Test + fun `testDouble§`() { + Assertions.assertEquals("1", "§§1".removeColorCodes()) + } + + @Test + fun testKeepNonColor() { + Assertions.assertEquals("§k§l§m§n§o§r", "§k§l§m§f§n§o§r".removeColorCodes(true)) + } + + @Test + fun testPlainString() { + Assertions.assertEquals("bcdefgp", "bcdefgp".removeColorCodes()) + Assertions.assertEquals("", "".removeColorCodes()) + } + + @Test + fun testSomeNormalTestCases() { + Assertions.assertEquals( + "You are not currently in a party.", + "§r§cYou are not currently in a party.§r".removeColorCodes() + ) + Assertions.assertEquals( + "Ancient Necron's Chestplate ✪✪✪✪", + "§dAncient Necron's Chestplate §6✪§6✪§6✪§6✪".removeColorCodes() + ) + } } |