From 6fa22b10957c4703a91c8909bd3919349650aa07 Mon Sep 17 00:00:00 2001 From: Kazik Pogoda Date: Fri, 6 Sep 2024 16:34:00 +0200 Subject: [PATCH] test updated to work with JS --- .../commonTest/kotlin/type/OscTypeTagsTest.kt | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/xemantic-osc-api/src/commonTest/kotlin/type/OscTypeTagsTest.kt b/xemantic-osc-api/src/commonTest/kotlin/type/OscTypeTagsTest.kt index a8b5901..f6d81f5 100644 --- a/xemantic-osc-api/src/commonTest/kotlin/type/OscTypeTagsTest.kt +++ b/xemantic-osc-api/src/commonTest/kotlin/type/OscTypeTagsTest.kt @@ -19,9 +19,11 @@ package com.xemantic.osc.type import com.xemantic.osc.OscException +import io.kotest.assertions.throwables.shouldThrow import kotlin.test.Test import io.kotest.matchers.shouldBe import io.kotest.assertions.throwables.shouldThrowWithMessage +import io.kotest.matchers.string.shouldStartWith class OscTypeTagTest { @@ -30,11 +32,6 @@ class OscTypeTagTest { 42.oscTypeTag shouldBe "i" } - @Test - fun floatOscTypeTagShouldBeF() { - 3.14f.oscTypeTag shouldBe "f" - } - @Test fun stringOscTypeTagShouldBeS() { "Hello".oscTypeTag shouldBe "s" @@ -65,11 +62,6 @@ class OscTypeTagTest { OscTimeTag.now().oscTypeTag shouldBe "t" } - @Test - fun longOscTypeTagShouldBeH() { - 123456789L.oscTypeTag shouldBe "h" - } - @Test fun doubleOscTypeTagShouldBeD() { 2.71828.oscTypeTag shouldBe "d" @@ -92,25 +84,21 @@ class OscTypeTagTest { @Test fun nestedListTypeTagsShouldBeCorrect() { - listOf(42, "Hello", true, null, listOf(3.14f, listOf('A'))).oscTypeTags() shouldBe "isTN[f[c]]" + listOf(42, "Hello", true, null, listOf(3.14, listOf('A'))).oscTypeTags() shouldBe "isTN[d[c]]" } @Test fun unsupportedOscTypeShouldThrowException() { - shouldThrowWithMessage( - "Type unsupported in OSC: class kotlin.Byte" - ) { - 0.toByte().oscTypeTag - } + shouldThrow { + mapOf().oscTypeTag + }.message shouldStartWith "Type unsupported in OSC" } @Test - fun listWithUnsupportedOscTypeShouldThrowException() { - shouldThrowWithMessage( - "Type unsupported in OSC: class kotlin.Any" - ) { - listOf(42, Any()).oscTypeTags() - } + fun listContainingUnsupportedOscTypeShouldThrowException() { + shouldThrow { + listOf(42, mapOf()).oscTypeTags() + }.message shouldStartWith "Type unsupported in OSC" } @Test