Skip to content

Commit

Permalink
Ignore tests that fail on LegacyJS due to missing commit in M1
Browse files Browse the repository at this point in the history
  • Loading branch information
sandwwraith committed Dec 24, 2020
1 parent 0fc3fdf commit 7ab7661
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class CborReaderTest {
* decoding to [Simple] (which has the field 'a') is expected to fail.
*/
@Test
@Ignore // fixme: legacyJs will work in 1.4.30-RC
fun testIgnoreUnknownKeysFailsWhenCborDataIsMissingKeysThatArePresentInKotlinClass() {
// with maps & lists of indefinite length
assertFailsWithMessage<SerializationException>("Field 'a' is required, but it was missing") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class InheritanceTest {
}

@Test
fun canBeSerializedAsParent() {
fun canBeSerializedAsParent() = noLegacyJs { // fixme: legacyJs will work in 1.4.30-RC
val derived = Derived(42)
val msg = json.encodeToString(SerializableBase.serializer(), derived)
assertEquals("""{"publicState":"A","privateState":"B"}""", msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ class JsonOptionalTests : JsonTestBase() {
}

@Test
fun testThrowMissingField() = parametrizedTest { useStreaming ->
assertFailsWithMissingField {
lenient.decodeFromString(Data.serializer(), "{b:0}", useStreaming)
fun testThrowMissingField() = noLegacyJs { // fixme: legacyJs will work in 1.4.30-RC
parametrizedTest { useStreaming ->
assertFailsWithMissingField {
lenient.decodeFromString(Data.serializer(), "{b:0}", useStreaming)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,51 @@ class JsonParserFailureModesTest : JsonTestBase() {
)

@Test
fun testFailureModes() = parametrizedTest {
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id": "}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id": ""}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id":a}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id":2.0}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id2":2}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id"}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"i}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"}""", it) }
assertFailsWithMissingField { default.decodeFromString(Holder.serializer(), """{}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{""", it) }
fun testFailureModes() = noLegacyJs { // fixme: legacyJs will work in 1.4.30-RC
parametrizedTest {
assertFailsWith<JsonDecodingException> {
default.decodeFromString(
Holder.serializer(),
"""{"id": "}""",
it
)
}
assertFailsWith<JsonDecodingException> {
default.decodeFromString(
Holder.serializer(),
"""{"id": ""}""",
it
)
}
assertFailsWith<JsonDecodingException> {
default.decodeFromString(
Holder.serializer(),
"""{"id":a}""",
it
)
}
assertFailsWith<JsonDecodingException> {
default.decodeFromString(
Holder.serializer(),
"""{"id":2.0}""",
it
)
}
assertFailsWith<JsonDecodingException> {
default.decodeFromString(
Holder.serializer(),
"""{"id2":2}""",
it
)
}
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id"}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"id}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"i}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{"}""", it) }
assertFailsWithMissingField { default.decodeFromString(Holder.serializer(), """{}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """}""", it) }
assertFailsWith<JsonDecodingException> { default.decodeFromString(Holder.serializer(), """{""", it) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class JsonTreeTest : JsonTestBase() {
}

@Test
fun testReadTreeNullable() {
fun testReadTreeNullable() = noLegacyJs { // fixme: legacyJs will work in 1.4.30-RC
val tree1 = prepare("""{s:"foo", d: null}""")
val tree2 = prepare("""{s:"foo"}""")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inline fun noJs(test: () -> Unit) {
if (!isJs()) test()
}

inline fun noLegacyJs(test: () -> Unit) {
if (!isJsLegacy()) test()
}

inline fun jvmOnly(test: () -> Unit) {
if (isJvm()) test()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class DecodeFromDynamicTest {
}

@Test
fun dynamicNullableTest() {
fun dynamicNullableTest() = noLegacyJs { // fixme: legacyJs will work in 1.4.30-RC
val dyn1 = js("""({s:"foo", d: null})""")
val dyn2 = js("""({s:"foo"})""")
val dyn3 = js("""({s:"foo", d: undefined})""")
Expand Down

0 comments on commit 7ab7661

Please sign in to comment.