From e2f8ecf4a1c234ad179a9074e144457bf3232920 Mon Sep 17 00:00:00 2001 From: "Sergey.Shanshin" Date: Wed, 18 May 2022 22:03:37 +0300 Subject: [PATCH] tests --- docs/formats.md | 1 - docs/serialization-guide.md | 3 +- formats/json-tests/build.gradle.kts | 50 +++++++ .../ClassWithMultipleMasksTest.kt | 0 .../serialization/EncodingCollectionsTest.kt | 0 .../serialization/EncodingExtensionsTest.kt | 0 .../serialization/EnumSerializationTest.kt | 0 .../GenericSerializersOnFileTest.kt | 0 .../serialization/JsonOverwriteKeyTest.kt | 0 .../src/kotlinx/serialization/JsonPathTest.kt | 0 ...tNullSerializersCompatibilityOnFileTest.kt | 6 +- .../serialization/PolymorphismTestData.kt | 0 .../serialization/SerializableClasses.kt | 0 .../SerializationForNullableTypeOnFileTest.kt | 0 .../SerializerForNullableTypeTest.kt | 0 .../serialization/SerializersLookupTest.kt | 0 .../src/kotlinx/serialization/TuplesTest.kt | 0 .../kotlinx/serialization/UmbrellaTypes.kt | 0 .../serialization/UnknownElementIndexTest.kt | 0 .../builtins/KeyValueSerializersTest.kt | 0 .../features/BinaryPayloadExampleTest.kt | 0 .../features/ByteArraySerializerTest.kt | 0 .../features/CollectionSerializerTest.kt | 2 - .../features/ContextAndPolymorphicTest.kt | 3 +- .../DerivedContextualSerializerTest.kt | 0 .../features/GenericCustomSerializerTest.kt | 2 +- .../serialization/features/InheritanceTest.kt | 0 .../features/JsonClassDiscriminatorTest.kt | 0 .../serialization/features/JsonNamesTest.kt | 0 .../features/LocalClassesTest.kt | 0 .../features/LongAsStringTest.kt | 0 .../features/ObjectSerialization.kt | 0 .../features/PartiallyCustomSerializerTest.kt | 0 .../features/PolymorphicOnClassesTest.kt | 0 .../features/PolymorphismTest.kt | 0 .../features/PolymorphismWithAnyTest.kt | 1 - .../features/PrimitiveArraySerializersTest.kt | 0 .../features/PropertyInitializerTest.kt | 0 .../SealedClassesSerializationTest.kt | 1 - .../features/SealedPolymorphismTest.kt | 0 .../features/SerializableOnTypeUsageTest.kt | 0 .../features/SerializableWithTest.kt | 0 .../serialization/features/SkipDefaults.kt | 0 .../features/UseSerializersTest.kt | 0 .../inline/EncodeInlineElementTest.kt | 0 .../inline/InlineClassesCompleteTest.kt | 0 .../features/inline/InlineClassesTest.kt | 0 .../features/inline/UnsignedIntegersTest.kt | 0 .../features/sealed/SealedChild.kt | 0 .../features/sealed/SealedParent.kt | 0 .../json/AbstractJsonImplicitNullsTest.kt | 0 .../json/BasicTypesSerializationTest.kt | 0 .../json/DecodeFromJsonElementTest.kt | 0 .../serialization/json/JsonBuildersTest.kt | 0 .../json/JsonCoerceInputValuesTest.kt | 5 +- .../json/JsonConfigurationTest.kt | 0 .../json/JsonCustomSerializersTest.kt | 2 +- .../json/JsonDefaultContextTest.kt | 0 .../json/JsonElementDecodingTest.kt | 0 .../json/JsonEncoderDecoderRecursiveTest.kt | 0 .../serialization/json/JsonGenericTest.kt | 0 .../json/JsonImplicitNullsTest.kt | 0 .../serialization/json/JsonMapKeysTest.kt | 7 +- .../serialization/json/JsonModesTest.kt | 0 .../serialization/json/JsonNumericKeysTest.kt | 0 .../serialization/json/JsonOptionalTests.kt | 0 .../json/JsonParserFailureModesTest.kt | 63 +++++---- .../serialization/json/JsonParserTest.kt | 12 +- .../json/JsonReifiedCollectionsTest.kt | 0 .../json/JsonRootLevelNullTest.kt | 0 .../json/JsonSealedSubclassTest.kt | 0 .../serialization/json/JsonTestBase.kt | 22 ++- .../json/JsonTransformingSerializerTest.kt | 0 .../serialization/json/JsonTransientTest.kt | 3 +- .../json/JsonTreeAndMapperTest.kt | 0 .../json/JsonTreeImplicitNullsTest.kt | 0 .../serialization/json/JsonTreeTest.kt | 1 - .../serialization/json/JsonUnicodeTest.kt | 0 .../serialization/json/JsonUnionEnumTest.kt | 0 .../serialization/json/JsonUpdateModeTest.kt | 0 .../kotlinx/serialization/json/LenientTest.kt | 11 +- .../json/MapLikeSerializerTest.kt | 0 .../json/SpecialFloatingPointValuesTest.kt | 6 +- .../JsonContentPolymorphicSerializerTest.kt | 0 .../JsonDeserializePolymorphicTwiceTest.kt | 0 .../polymorphic/JsonListPolymorphismTest.kt | 0 .../polymorphic/JsonMapPolymorphismTest.kt | 0 .../polymorphic/JsonNestedPolymorphismTest.kt | 0 .../JsonNullablePolymorphicTest.kt | 0 .../JsonPolymorphicClassDescriptorTest.kt | 0 .../polymorphic/JsonPolymorphicObjectTest.kt | 0 .../JsonPolymorphismExceptionTest.kt | 5 +- .../JsonProhibitedPolymorphicKindsTest.kt | 0 .../JsonPropertyPolymorphicTest.kt | 0 .../json/polymorphic/PolymorphicClasses.kt | 0 .../serializers/JsonArraySerializerTest.kt | 21 ++- .../serializers/JsonNativePrimitivesTest.kt | 0 .../serializers/JsonNullSerializerTest.kt | 19 ++- .../serializers/JsonObjectSerializerTest.kt | 125 ++++++++++++++++++ .../JsonPrimitiveSerializerTest.kt | 14 +- .../JsonSerializerInGenericsTest.kt | 0 .../json/serializers/JsonTreeTest.kt | 2 +- .../json/serializers/Primitives.kt | 0 .../SerialNameCollisionInSealedClassesTest.kt | 0 .../modules/SerialNameCollisionTest.kt | 0 .../serialization/test/ContextualTest.kt | 0 .../test/CurrentPlatform.common.kt | 0 .../test/InternalHexConverter.kt | 0 .../kotlinx/serialization/test/JsonHelpers.kt | 0 .../kotlinx/serialization/test/TestHelpers.kt | 0 .../src/kotlinx/serialization/test/TestId.kt | 0 .../serialization/test/TestingFramework.kt | 29 ++++ .../json/DecodeFromDynamicSpecialCasesTest.kt | 0 .../json/DecodeFromDynamicTest.kt | 0 .../json/DynamicPolymorphismTest.kt | 0 .../serialization/json/DynamicToLongTest.kt | 0 .../json/EncodeToDynamicSpecialCasesTest.kt | 5 - .../serialization/json/EncodeToDynamicTest.kt | 0 .../json/JsonCoerceInputValuesDynamicTest.kt | 0 .../json/JsonDynamicImplicitNullsTest.kt | 0 .../json/JsonNamesDynamicTest.kt | 0 .../serialization/test/CurrentPlatform.kt | 0 .../kotlinx/serialization/test/JsonHelpers.kt | 0 .../resources/corner_cases/listing.txt | 0 .../resources/corner_cases/number_1.0.json | 0 .../number_1.000000000000000005.json | 0 .../corner_cases/number_1000000000000000.json | 0 .../number_10000000000000000999.json | 0 .../resources/corner_cases/number_1e-999.json | 0 .../resources/corner_cases/number_1e6.json | 0 .../corner_cases/object_key_nfc_nfd.json | 0 .../corner_cases/object_key_nfd_nfc.json | 0 .../object_same_key_different_values.json | 0 .../object_same_key_same_value.json | 0 .../object_same_key_unclear_values.json | 0 .../string_1_escaped_invalid_codepoint.json | 0 .../string_1_invalid_codepoint.json | 0 .../string_2_escaped_invalid_codepoints.json | 0 .../string_2_invalid_codepoints.json | 0 .../string_3_escaped_invalid_codepoints.json | 0 .../string_3_invalid_codepoints.json | 0 .../string_with_escaped_NULL.json | 0 .../jvmTest/resources/corpus.zip | Bin .../jvmTest/resources/spec_cases/listing.txt | 0 .../n_array_1_true_without_comma.json | 0 .../spec_cases/n_array_a_invalid_utf8.json | 0 .../n_array_colon_instead_of_comma.json | 0 .../spec_cases/n_array_comma_after_close.json | 0 .../spec_cases/n_array_comma_and_number.json | 0 .../spec_cases/n_array_double_comma.json | 0 .../n_array_double_extra_comma.json | 0 .../spec_cases/n_array_extra_close.json | 0 .../spec_cases/n_array_extra_comma.json | 0 .../spec_cases/n_array_incomplete.json | 0 .../n_array_incomplete_invalid_value.json | 0 .../n_array_inner_array_no_comma.json | 0 .../spec_cases/n_array_invalid_utf8.json | 0 .../n_array_items_separated_by_semicolon.json | 0 .../spec_cases/n_array_just_comma.json | 0 .../spec_cases/n_array_just_minus.json | 0 .../spec_cases/n_array_missing_value.json | 0 .../spec_cases/n_array_newlines_unclosed.json | 0 .../spec_cases/n_array_number_and_comma.json | 0 .../n_array_number_and_several_commas.json | 0 .../n_array_spaces_vertical_tab_formfeed.json | 0 .../spec_cases/n_array_star_inside.json | 0 .../spec_cases/n_array_unclosed.json | 0 .../n_array_unclosed_trailing_comma.json | 0 .../n_array_unclosed_with_new_lines.json | 0 .../n_array_unclosed_with_object_inside.json | 0 .../spec_cases/n_incomplete_false.json | 0 .../spec_cases/n_incomplete_null.json | 0 .../spec_cases/n_incomplete_true.json | 0 .../n_multidigit_number_then_00.json | Bin .../spec_cases/n_object_bad_value.json | 0 .../spec_cases/n_object_bracket_key.json | 0 .../n_object_comma_instead_of_colon.json | 0 .../spec_cases/n_object_double_colon.json | 0 .../resources/spec_cases/n_object_emoji.json | 0 .../spec_cases/n_object_garbage_at_end.json | 0 .../n_object_key_with_single_quotes.json | 0 ...uation_byte_in_key_and_trailing_comma.json | 0 .../spec_cases/n_object_missing_colon.json | 0 .../spec_cases/n_object_missing_key.json | 0 .../n_object_missing_semicolon.json | 0 .../spec_cases/n_object_missing_value.json | 0 .../spec_cases/n_object_no-colon.json | 0 .../spec_cases/n_object_non_string_key.json | 0 ...on_string_key_but_huge_number_instead.json | 0 .../n_object_repeated_null_null.json | 0 .../n_object_several_trailing_commas.json | 0 .../spec_cases/n_object_single_quote.json | 0 .../spec_cases/n_object_trailing_comma.json | 0 .../spec_cases/n_object_trailing_comment.json | 0 .../n_object_trailing_comment_open.json | 0 .../n_object_trailing_comment_slash_open.json | 0 ...railing_comment_slash_open_incomplete.json | 0 .../n_object_two_commas_in_a_row.json | 0 .../spec_cases/n_object_unquoted_key.json | 0 .../n_object_unterminated-value.json | 0 .../n_object_with_single_string.json | 0 .../n_object_with_trailing_garbage.json | 0 .../resources/spec_cases/n_single_space.json | 0 .../n_string_1_surrogate_then_escape.json | 0 .../n_string_1_surrogate_then_escape_u.json | 0 .../n_string_1_surrogate_then_escape_u1.json | 0 .../n_string_1_surrogate_then_escape_u1x.json | 0 .../n_string_accentuated_char_no_quotes.json | 0 .../spec_cases/n_string_backslash_00.json | Bin .../spec_cases/n_string_escape_x.json | 0 .../n_string_escaped_backslash_bad.json | 0 .../n_string_escaped_ctrl_char_tab.json | 0 .../spec_cases/n_string_escaped_emoji.json | 0 .../n_string_incomplete_escape.json | 0 ...n_string_incomplete_escaped_character.json | 0 .../n_string_incomplete_surrogate.json | 0 ...g_incomplete_surrogate_escape_invalid.json | 0 .../n_string_invalid-utf-8-in-escape.json | 0 .../n_string_invalid_backslash_esc.json | 0 .../n_string_invalid_unicode_escape.json | 0 .../n_string_invalid_utf8_after_escape.json | 0 .../n_string_leading_uescaped_thinspace.json | 0 .../n_string_no_quotes_with_bad_escape.json | 0 .../n_string_single_doublequote.json | 0 .../spec_cases/n_string_single_quote.json | 0 ...string_single_string_no_double_quotes.json | 0 .../n_string_start_escape_unclosed.json | 0 .../n_string_unescaped_crtl_char.json | Bin .../n_string_unescaped_newline.json | 0 .../spec_cases/n_string_unescaped_tab.json | 0 .../spec_cases/n_string_unicode_CapitalU.json | 0 .../n_string_with_trailing_garbage.json | 0 .../n_structure_100000_opening_arrays.json | 0 .../n_structure_U+2060_word_joined.json | 0 .../n_structure_UTF8_BOM_no_data.json | 0 .../n_structure_angle_bracket_..json | 0 .../n_structure_angle_bracket_null.json | 0 .../n_structure_array_trailing_garbage.json | 0 ...tructure_array_with_extra_array_close.json | 0 ..._structure_array_with_unclosed_string.json | 0 .../n_structure_ascii-unicode-identifier.json | 0 .../n_structure_capitalized_True.json | 0 .../n_structure_close_unopened_array.json | 0 ...ucture_comma_instead_of_closing_brace.json | 0 .../spec_cases/n_structure_double_array.json | 0 .../spec_cases/n_structure_end_array.json | 0 .../n_structure_incomplete_UTF8_BOM.json | 0 .../n_structure_lone-invalid-utf-8.json | 0 .../n_structure_lone-open-bracket.json | 0 .../spec_cases/n_structure_no_data.json | 0 .../n_structure_null-byte-outside-string.json | Bin ...tructure_number_with_trailing_garbage.json | 0 ...ure_object_followed_by_closing_object.json | 0 .../n_structure_object_unclosed_no_value.json | 0 .../n_structure_object_with_comment.json | 0 ...tructure_object_with_trailing_garbage.json | 0 .../n_structure_open_array_apostrophe.json | 0 .../n_structure_open_array_comma.json | 0 .../n_structure_open_array_object.json | 0 .../n_structure_open_array_open_object.json | 0 .../n_structure_open_array_open_string.json | 0 .../n_structure_open_array_string.json | 0 .../spec_cases/n_structure_open_object.json | 0 .../n_structure_open_object_close_array.json | 0 .../n_structure_open_object_comma.json | 0 .../n_structure_open_object_open_array.json | 0 .../n_structure_open_object_open_string.json | 0 ...e_open_object_string_with_apostrophes.json | 0 .../spec_cases/n_structure_open_open.json | 0 .../spec_cases/n_structure_single_star.json | 0 .../spec_cases/n_structure_trailing_#.json | 0 ...n_structure_uescaped_LF_before_string.json | 0 .../n_structure_unclosed_array.json | 0 ...structure_unclosed_array_partial_null.json | 0 ...cture_unclosed_array_unfinished_false.json | 0 ...ucture_unclosed_array_unfinished_true.json | 0 .../n_structure_unclosed_object.json | 0 .../n_structure_unicode-identifier.json | 0 ...ructure_whitespace_U+2060_word_joiner.json | 0 .../n_structure_whitespace_formfeed.json | 0 .../spec_cases/y_array_arraysWithSpaces.json | 0 .../spec_cases/y_array_empty-string.json | 0 .../resources/spec_cases/y_array_empty.json | 0 .../y_array_ending_with_newline.json | 0 .../resources/spec_cases/y_array_false.json | 0 .../spec_cases/y_array_heterogeneous.json | 0 .../resources/spec_cases/y_array_null.json | 0 .../y_array_with_1_and_newline.json | 0 .../y_array_with_leading_space.json | 0 .../spec_cases/y_array_with_several_null.json | 0 .../y_array_with_trailing_space.json | 0 .../resources/spec_cases/y_number.json | 0 .../resources/spec_cases/y_number_0e+1.json | 0 .../resources/spec_cases/y_number_0e1.json | 0 .../spec_cases/y_number_after_space.json | 0 .../y_number_double_close_to_zero.json | 0 .../spec_cases/y_number_int_with_exp.json | 0 .../spec_cases/y_number_minus_zero.json | 0 .../spec_cases/y_number_negative_int.json | 0 .../spec_cases/y_number_negative_one.json | 0 .../spec_cases/y_number_negative_zero.json | 0 .../spec_cases/y_number_real_capital_e.json | 0 .../y_number_real_capital_e_neg_exp.json | 0 .../y_number_real_capital_e_pos_exp.json | 0 .../spec_cases/y_number_real_exponent.json | 0 .../y_number_real_fraction_exponent.json | 0 .../spec_cases/y_number_real_neg_exp.json | 0 .../y_number_real_pos_exponent.json | 0 .../spec_cases/y_number_simple_int.json | 0 .../spec_cases/y_number_simple_real.json | 0 .../resources/spec_cases/y_object.json | 0 .../resources/spec_cases/y_object_basic.json | 0 .../spec_cases/y_object_duplicated_key.json | 0 .../y_object_duplicated_key_and_value.json | 0 .../resources/spec_cases/y_object_empty.json | 0 .../spec_cases/y_object_empty_key.json | 0 .../y_object_escaped_null_in_key.json | 0 .../spec_cases/y_object_extreme_numbers.json | 0 .../spec_cases/y_object_long_strings.json | 0 .../resources/spec_cases/y_object_simple.json | 0 .../spec_cases/y_object_string_unicode.json | 0 .../spec_cases/y_object_with_newlines.json | 0 .../y_string_1_2_3_bytes_UTF-8_sequences.json | 0 .../y_string_accepted_surrogate_pair.json | 0 .../y_string_accepted_surrogate_pairs.json | 0 .../spec_cases/y_string_allowed_escapes.json | 0 ...y_string_backslash_and_u_escaped_zero.json | 0 .../y_string_backslash_doublequotes.json | 0 .../spec_cases/y_string_comments.json | 0 .../spec_cases/y_string_double_escape_a.json | 0 .../spec_cases/y_string_double_escape_n.json | 0 .../y_string_escaped_control_character.json | 0 .../y_string_escaped_noncharacter.json | 0 .../spec_cases/y_string_in_array.json | 0 .../y_string_in_array_with_leading_space.json | 0 .../y_string_last_surrogates_1_and_2.json | 0 .../spec_cases/y_string_nbsp_uescaped.json | 0 ...y_string_nonCharacterInUTF-8_U+10FFFF.json | 0 .../y_string_nonCharacterInUTF-8_U+FFFF.json | 0 .../spec_cases/y_string_null_escape.json | 0 .../spec_cases/y_string_one-byte-utf-8.json | 0 .../resources/spec_cases/y_string_pi.json | 0 ...ring_reservedCharacterInUTF-8_U+1BFFF.json | 0 .../spec_cases/y_string_simple_ascii.json | 0 .../resources/spec_cases/y_string_space.json | 0 ...rogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json | 0 .../spec_cases/y_string_three-byte-utf-8.json | 0 .../spec_cases/y_string_two-byte-utf-8.json | 0 .../spec_cases/y_string_u+2028_line_sep.json | 0 .../spec_cases/y_string_u+2029_par_sep.json | 0 .../spec_cases/y_string_uEscape.json | 0 .../spec_cases/y_string_uescaped_newline.json | 0 .../y_string_unescaped_char_delete.json | 0 .../spec_cases/y_string_unicode.json | 0 .../y_string_unicodeEscapedBackslash.json | 0 .../spec_cases/y_string_unicode_2.json | 0 .../y_string_unicode_U+10FFFE_nonchar.json | 0 .../y_string_unicode_U+1FFFE_nonchar.json | 0 ...tring_unicode_U+200B_ZERO_WIDTH_SPACE.json | 0 ..._string_unicode_U+2064_invisible_plus.json | 0 .../y_string_unicode_U+FDD0_nonchar.json | 0 .../y_string_unicode_U+FFFE_nonchar.json | 0 ...y_string_unicode_escaped_double_quote.json | 0 .../resources/spec_cases/y_string_utf8.json | 0 .../y_string_with_del_character.json | 0 .../spec_cases/y_structure_lonely_false.json | 0 .../spec_cases/y_structure_lonely_int.json | 0 .../y_structure_lonely_negative_real.json | 0 .../spec_cases/y_structure_lonely_null.json | 0 .../spec_cases/y_structure_lonely_string.json | 0 .../spec_cases/y_structure_lonely_true.json | 0 .../spec_cases/y_structure_string_empty.json | 0 .../y_structure_trailing_newline.json | 0 .../spec_cases/y_structure_true_in_array.json | 0 .../y_structure_whitespace_array.json | 0 .../serialization/JavaCollectionsTest.kt | 0 .../JvmMissingFieldsExceptionTest.kt | 1 - .../serialization/SerializationCasesTest.kt | 0 .../serialization/SerializeJavaClassTest.kt | 1 - .../SerializerForNullableJavaTypeTest.kt | 0 .../serialization/StacktraceRecoveryTest.kt | 17 +-- .../ContextualSerializationOnFileTest.kt | 0 .../features/InternalInheritanceTest.kt | 0 .../features/JsonJvmStreamsTest.kt | 0 .../features/JsonLazySequenceTest.kt | 12 +- .../features/JsonSequencePathTest.kt | 8 -- .../features/SerializerByTypeTest.kt | 0 .../json/GsonCompatibilityTest.kt | 0 .../json/ParallelJsonStressTest.kt | 0 .../serialization/json/SpecConformanceTest.kt | Bin .../serialization/test/CurrentPlatform.kt | 0 .../kotlinx/serialization/test/JsonHelpers.kt | 0 .../serialization/json/MultiWorkerJsonTest.kt | 0 .../serialization/test/CurrentPlatform.kt | 0 .../kotlinx/serialization/test/JsonHelpers.kt | 0 .../json/api/kotlinx-serialization-json.api | 73 ++++++++++ formats/json/build.gradle | 11 -- .../kotlinx/serialization/json/JsonElement.kt | 3 +- .../json/internal/StreamingJsonDecoder.kt | 3 +- .../json/internal/TreeJsonDecoder.kt | 3 +- .../json/internal/TreeJsonEncoder.kt | 3 +- .../serialization/json/internal/WriteMode.kt | 3 +- .../json/internal/lexer/AbstractJsonLexer.kt | 59 +++++---- .../lexer/{JsonLexerJvm.kt => JsonLexer.kt} | 13 +- .../json/internal/lexer/StringJsonLexer.kt | 5 +- .../serializers/JsonObjectSerializerTest.kt | 125 ------------------ .../json/internal/DynamicDecoders.kt | 3 +- .../json/internal/JvmJsonStreams.kt | 22 --- settings.gradle | 3 + 409 files changed, 451 insertions(+), 338 deletions(-) create mode 100644 formats/json-tests/build.gradle.kts rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/EncodingCollectionsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/EncodingExtensionsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/GenericSerializersOnFileTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/JsonOverwriteKeyTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/JsonPathTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt (96%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/SerializableClasses.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/TuplesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt (93%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt (98%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/DerivedContextualSerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt (98%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/JsonClassDiscriminatorTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/JsonNamesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/LocalClassesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt (99%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/PropertyInitializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt (99%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/inline/InlineClassesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/inline/UnsignedIntegersTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/sealed/SealedChild.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/features/sealed/SealedParent.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/AbstractJsonImplicitNullsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/DecodeFromJsonElementTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt (93%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt (98%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonElementDecodingTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonImplicitNullsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt (93%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt (53%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt (89%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt (86%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt (94%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTreeImplicitNullsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt (99%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonUnicodeTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/LenientTest.kt (84%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt (82%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt (88%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt (84%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt (69%) create mode 100644 formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt (87%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt (99%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/ContextualTest.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/JsonHelpers.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/TestHelpers.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/TestId.kt (100%) rename formats/{json => json-tests}/commonTest/src/kotlinx/serialization/test/TestingFramework.kt (68%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicSpecialCasesTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/DynamicPolymorphismTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt (92%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/JsonCoerceInputValuesDynamicTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/JsonDynamicImplicitNullsTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/json/JsonNamesDynamicTest.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt (100%) rename formats/{json => json-tests}/jsTest/src/kotlinx/serialization/test/JsonHelpers.kt (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/listing.txt (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_1.0.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_1.000000000000000005.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_1000000000000000.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_10000000000000000999.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_1e-999.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/number_1e6.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/object_key_nfc_nfd.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/object_key_nfd_nfc.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/object_same_key_different_values.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/object_same_key_same_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/object_same_key_unclear_values.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corner_cases/string_with_escaped_NULL.json (100%) rename formats/{json => json-tests}/jvmTest/resources/corpus.zip (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/listing.txt (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_comma_after_close.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_comma_and_number.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_double_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_double_extra_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_extra_close.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_extra_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_incomplete.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_invalid_utf8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_just_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_just_minus.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_missing_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_number_and_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_star_inside.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_unclosed.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_incomplete_false.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_incomplete_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_incomplete_true.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_bad_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_bracket_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_double_colon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_emoji.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_garbage_at_end.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_missing_colon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_missing_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_missing_semicolon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_missing_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_no-colon.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_non_string_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_repeated_null_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_single_quote.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_trailing_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_trailing_comment.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_unquoted_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_unterminated-value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_with_single_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_single_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_backslash_00.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_escape_x.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_escaped_emoji.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_incomplete_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_single_doublequote.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_single_quote.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_unescaped_newline.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_unescaped_tab.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_capitalized_True.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_double_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_end_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_no_data.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_object_with_comment.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_array_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object_comma.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_open_open.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_single_star.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_trailing_#.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unclosed_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unclosed_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_empty-string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_empty.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_ending_with_newline.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_false.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_heterogeneous.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_with_leading_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_with_several_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_array_with_trailing_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_0e+1.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_0e1.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_after_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_int_with_exp.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_minus_zero.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_negative_int.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_negative_one.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_negative_zero.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_capital_e.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_exponent.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_neg_exp.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_simple_int.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_number_simple_real.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_basic.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_duplicated_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_empty.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_empty_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_extreme_numbers.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_long_strings.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_simple.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_string_unicode.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_object_with_newlines.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_allowed_escapes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_comments.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_double_escape_a.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_double_escape_n.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_escaped_control_character.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_in_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_null_escape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_pi.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_simple_ascii.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_space.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_uEscape.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_uescaped_newline.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_2.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_utf8.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_string_with_del_character.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_false.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_int.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_null.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_string.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_lonely_true.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_string_empty.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_trailing_newline.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_true_in_array.json (100%) rename formats/{json => json-tests}/jvmTest/resources/spec_cases/y_structure_whitespace_array.json (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt (99%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt (98%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt (76%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/JsonJvmStreamsTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt (95%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt (73%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/json/ParallelJsonStressTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt (100%) rename formats/{json => json-tests}/jvmTest/src/kotlinx/serialization/test/JsonHelpers.kt (100%) rename formats/{json => json-tests}/nativeTest/src/kotlinx/serialization/json/MultiWorkerJsonTest.kt (100%) rename formats/{json => json-tests}/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt (100%) rename formats/{json => json-tests}/nativeTest/src/kotlinx/serialization/test/JsonHelpers.kt (100%) rename formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/{JsonLexerJvm.kt => JsonLexer.kt} (94%) delete mode 100644 formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt diff --git a/docs/formats.md b/docs/formats.md index 93b524094..7a6b0a07e 100644 --- a/docs/formats.md +++ b/docs/formats.md @@ -18,7 +18,6 @@ stable, these are currently experimental features of Kotlin Serialization. * [Integer types](#integer-types) * [Lists as repeated fields](#lists-as-repeated-fields) * [Packed fields](#packed-fields) - * [ProtoBuf schema generator (experimental)](#protobuf-schema-generator-experimental) * [Properties (experimental)](#properties-experimental) * [Custom formats (experimental)](#custom-formats-experimental) * [Basic encoder](#basic-encoder) diff --git a/docs/serialization-guide.md b/docs/serialization-guide.md index 3506fcf06..46a54d21b 100644 --- a/docs/serialization-guide.md +++ b/docs/serialization-guide.md @@ -115,7 +115,7 @@ Once the project is set up, we can start serializing some classes. * [Explicit nulls](json.md#explicit-nulls) * [Allowing structured map keys](json.md#allowing-structured-map-keys) * [Allowing special floating-point values](json.md#allowing-special-floating-point-values) - * [Class discriminator](json.md#class-discriminator) + * [Class discriminator for polymorphism](json.md#class-discriminator-for-polymorphism) * [Json elements](json.md#json-elements) * [Parsing to Json element](json.md#parsing-to-json-element) * [Types of Json elements](json.md#types-of-json-elements) @@ -140,6 +140,7 @@ Once the project is set up, we can start serializing some classes. * [Field numbers](formats.md#field-numbers) * [Integer types](formats.md#integer-types) * [Lists as repeated fields](formats.md#lists-as-repeated-fields) + * [Packed fields](formats.md#packed-fields) * [Properties (experimental)](formats.md#properties-experimental) * [Custom formats (experimental)](formats.md#custom-formats-experimental) * [Basic encoder](formats.md#basic-encoder) diff --git a/formats/json-tests/build.gradle.kts b/formats/json-tests/build.gradle.kts new file mode 100644 index 000000000..5d21ed902 --- /dev/null +++ b/formats/json-tests/build.gradle.kts @@ -0,0 +1,50 @@ +/* + * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ +import Java9Modularity.configureJava9ModuleInfo + +plugins { + kotlin("multiplatform") + kotlin("plugin.serialization") +} +// +apply(from = rootProject.file("gradle/native-targets.gradle")) +apply(from = rootProject.file("gradle/configure-source-sets.gradle")) + +// disable kover tasks because there are no non-test classes in the project +tasks.koverHtmlReport { + enabled = false +} +tasks.koverXmlReport { + enabled = false +} +tasks.koverVerify { + enabled = false +} + +kotlin { + sourceSets { + val commonTest by getting { + dependencies { + api(project(":kotlinx-serialization-json")) + api(project(":kotlinx-serialization-json-okio")) + implementation("com.squareup.okio:okio:3.1.0") + } + } + + val jvmTest by getting { + dependencies { + implementation("com.google.code.gson:gson:2.8.5") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${property("coroutines_version")}") + } + } + } +} + +tasks.withType { + if (this.name == "compileTestKotlinJsLegacy") { + this.exclude("**/PropertyInitializerTest.kt") + } +} + +project.configureJava9ModuleInfo() diff --git a/formats/json/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/EncodingCollectionsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/EncodingCollectionsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/EncodingCollectionsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/EncodingCollectionsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/EncodingExtensionsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/EncodingExtensionsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/EncodingExtensionsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/EncodingExtensionsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/GenericSerializersOnFileTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/GenericSerializersOnFileTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/GenericSerializersOnFileTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/GenericSerializersOnFileTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/JsonOverwriteKeyTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/JsonOverwriteKeyTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/JsonOverwriteKeyTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/JsonOverwriteKeyTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/JsonPathTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/JsonPathTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/JsonPathTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/JsonPathTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt similarity index 96% rename from formats/json/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt index b44a37f3b..bd928ddb2 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/NotNullSerializersCompatibilityOnFileTest.kt @@ -86,7 +86,11 @@ class NotNullSerializersCompatibilityOnFileTest { val json = Json { serializersModule = module } assertEquals("""{"nullable":null,"nonNullable":"foo"}""", json.encodeToString(FileContextualHolder(null, FileContextualType("foo")))) - assertEquals("""{"nullable":"foo","nonNullable":"bar"}""", json.encodeToString(FileContextualHolder(FileContextualType("foo"), FileContextualType("bar")))) + assertEquals("""{"nullable":"foo","nonNullable":"bar"}""", json.encodeToString( + FileContextualHolder( + FileContextualType("foo"), FileContextualType("bar") + ) + )) assertEquals(FileContextualHolder(null, FileContextualType("foo")), json.decodeFromString("""{"nullable":null,"nonNullable":"foo"}""")) assertEquals(FileContextualHolder(FileContextualType("foo"), FileContextualType("bar")), json.decodeFromString("""{"nullable":"foo","nonNullable":"bar"}""")) diff --git a/formats/json/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/SerializableClasses.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/SerializableClasses.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/SerializableClasses.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/SerializableClasses.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/TuplesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/TuplesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/TuplesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/TuplesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt similarity index 93% rename from formats/json/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt index ca8116a0b..022ef0eb7 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/features/CollectionSerializerTest.kt @@ -5,9 +5,7 @@ package kotlinx.serialization.features import kotlinx.serialization.* -import kotlinx.serialization.builtins.* import kotlinx.serialization.json.Json -import kotlinx.serialization.test.* import kotlin.test.* class CollectionSerializerTest { diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt similarity index 98% rename from formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt index 8f00ad97d..ac24cf04c 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt @@ -69,7 +69,8 @@ class ContextAndPolymorphicTest { @Test fun testReadCustom() { - val s = json.decodeFromString(EnhancedData.serializer(), + val s = json.decodeFromString( + EnhancedData.serializer(), """{"data":{"a":100500,"b":42},"stringPayload":{"s":"string"},"binaryPayload":"62696E617279"}""") assertEquals(value, s) } diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/DerivedContextualSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/DerivedContextualSerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/DerivedContextualSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/DerivedContextualSerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt similarity index 98% rename from formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt index 804dca6c4..d246f0a11 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt @@ -99,7 +99,7 @@ class GenericCustomSerializerTest { fun testContextualGeneric() { val module = SerializersModule { @Suppress("UNCHECKED_CAST") - contextual(CheckedData::class) { args -> CheckedDataSerializer(args[0] as KSerializer)} + contextual(CheckedData::class) { args -> CheckedDataSerializer(args[0] as KSerializer) } } assertStringFormAndRestored( """{"data":{"data":"my data","checkSum":"2A20"}}""", diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/JsonClassDiscriminatorTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/JsonClassDiscriminatorTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/JsonClassDiscriminatorTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/JsonClassDiscriminatorTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/JsonNamesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/JsonNamesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/JsonNamesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/JsonNamesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/LocalClassesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/LocalClassesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/LocalClassesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/LocalClassesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt similarity index 99% rename from formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt index 9ce0ea9bf..e1d38fdd5 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt @@ -9,7 +9,6 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.modules.* import kotlinx.serialization.modules.plus import kotlinx.serialization.test.assertStringFormAndRestored -import kotlinx.serialization.test.isJs import kotlin.test.* class PolymorphismWithAnyTest { diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/PropertyInitializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/PropertyInitializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/PropertyInitializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/PropertyInitializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt similarity index 99% rename from formats/json/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt index 8af90553d..a99c2a1d5 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt @@ -11,7 +11,6 @@ import kotlinx.serialization.features.sealed.SealedParent import kotlinx.serialization.internal.* import kotlinx.serialization.json.* import kotlinx.serialization.modules.* -import kotlinx.serialization.test.* import kotlin.test.* class SealedClassesSerializationTest : JsonTestBase() { diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/EncodeInlineElementTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/InlineClassesCompleteTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/InlineClassesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/inline/InlineClassesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/InlineClassesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/inline/UnsignedIntegersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/UnsignedIntegersTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/inline/UnsignedIntegersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/inline/UnsignedIntegersTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/sealed/SealedChild.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/sealed/SealedChild.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/sealed/SealedChild.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/sealed/SealedChild.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/features/sealed/SealedParent.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/features/sealed/SealedParent.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/features/sealed/SealedParent.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/features/sealed/SealedParent.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/AbstractJsonImplicitNullsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/AbstractJsonImplicitNullsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/AbstractJsonImplicitNullsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/AbstractJsonImplicitNullsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/DecodeFromJsonElementTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/DecodeFromJsonElementTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/DecodeFromJsonElementTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/DecodeFromJsonElementTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt similarity index 93% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt index 1e6b20ded..fd8d516c7 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCoerceInputValuesTest.kt @@ -6,6 +6,7 @@ package kotlinx.serialization.json import kotlinx.serialization.* import kotlinx.serialization.json.internal.* +import kotlinx.serialization.test.assertFailsWithSerial import kotlin.test.* class JsonCoerceInputValuesTest : JsonTestBase() { @@ -60,10 +61,10 @@ class JsonCoerceInputValuesTest : JsonTestBase() { WithEnum(), WithEnum.serializer() ) - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { json.decodeFromString(WithEnum.serializer(), """{"e":{"x":"definitely not a valid enum value"}}""") } - assertFailsWith { // test user still sees exception on missing quotes + assertFailsWithSerial("JsonDecodingException") { // test user still sees exception on missing quotes Json(json) { isLenient = false }.decodeFromString(WithEnum.serializer(), """{"e":unknown_value}""") } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt similarity index 98% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt index 91b65d9be..bad5f962a 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt @@ -199,7 +199,7 @@ class JsonCustomSerializersTest : JsonTestBase() { fun testReadListOfOptional() = parametrizedTest { jsonTestingMode -> val obj = listOf(C(a = 1), C(b = 2), C(3, 4)) val j = """[{"b":42,"a":1},{"b":2},{"b":4,"a":3}]""" - val s = jsonNoAltNames.decodeFromString(ListSerializer(C), j, jsonTestingMode) + val s = jsonNoAltNames.decodeFromString(ListSerializer(C), j, jsonTestingMode) assertEquals(obj, s) } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonElementDecodingTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonElementDecodingTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonElementDecodingTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonElementDecodingTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonImplicitNullsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonImplicitNullsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonImplicitNullsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonImplicitNullsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt similarity index 93% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt index e958cca74..5ef340156 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt @@ -8,10 +8,8 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor -import kotlinx.serialization.descriptors.buildSerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import kotlinx.serialization.json.internal.* import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.test.* import kotlin.jvm.* @@ -81,10 +79,9 @@ class JsonMapKeysTest : JsonTestBase() { } private inline fun verifyProhibition(value: T, streaming: JsonTestingMode) { - val e = assertFailsWith { + assertFailsWithSerialMessage("JsonEncodingException", "can't be used in JSON as a key in the map") { Json.encodeToString(value, streaming) } - assertTrue(e.message?.contains("can't be used in JSON as a key in the map") == true) } @Test @@ -143,7 +140,7 @@ class JsonMapKeysTest : JsonTestBase() { WithContextualKey(mapOf(ContextualValue("fooKey") to 1)), """{"map":{"fooKey":1}}""", Json { - serializersModule = SerializersModule { contextual(ContextualValue::class, ContextualValue.Companion) } + serializersModule = SerializersModule { contextual(ContextualValue::class, ContextualValue) } } ) } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt similarity index 53% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt index 87b0f3582..892696b8c 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt @@ -5,7 +5,6 @@ package kotlinx.serialization.json import kotlinx.serialization.* -import kotlinx.serialization.json.internal.* import kotlinx.serialization.test.* import kotlin.test.* @@ -18,35 +17,35 @@ class JsonParserFailureModesTest : JsonTestBase() { @Test fun testFailureModes() = parametrizedTest { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id": "}""", it ) } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id": ""}""", it ) } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id":a}""", it ) } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id":2.0}""", it ) } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id2":2}""", @@ -54,7 +53,7 @@ class JsonParserFailureModesTest : JsonTestBase() { ) } // 9223372036854775807 is Long.MAX_VALUE - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id":${Long.MAX_VALUE}""" + "00" + "}", @@ -62,21 +61,21 @@ class JsonParserFailureModesTest : JsonTestBase() { ) } // -9223372036854775808 is Long.MIN_VALUE - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( Holder.serializer(), """{"id":9223372036854775808}""", it ) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{"id"}""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{"id}""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{"i}""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{"}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{"id"}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{"id}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{"i}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{"}""", it) } assertFailsWithMissingField { default.decodeFromString(Holder.serializer(), """{}""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """}""", it) } - assertFailsWith { default.decodeFromString(Holder.serializer(), """{""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), """{""", it) } } @Serializable @@ -84,14 +83,14 @@ class JsonParserFailureModesTest : JsonTestBase() { @Test fun testBoolean() = parametrizedTest { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( BooleanHolder.serializer(), """{"b": fals}""", it ) } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( BooleanHolder.serializer(), """{"b": 123}""", @@ -108,11 +107,11 @@ class JsonParserFailureModesTest : JsonTestBase() { @Test fun testOverflow() = parametrizedTest { // Byte overflow - assertFailsWith { default.decodeFromString("""{"b": 128}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"b": 128}""", it) } // Short overflow - assertFailsWith { default.decodeFromString("""{"s": 32768}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"s": 32768}""", it) } // Int overflow - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString( """{"i": 2147483648}""", it @@ -134,14 +133,14 @@ class JsonParserFailureModesTest : JsonTestBase() { @Test fun testInvalidNumber() = parametrizedTest { - assertFailsWith { default.decodeFromString("""{"id":-}""", it) } - assertFailsWith { default.decodeFromString("""{"id":+}""", it) } - assertFailsWith { default.decodeFromString("""{"id":--}""", it) } - assertFailsWith { default.decodeFromString("""{"id":1-1}""", it) } - assertFailsWith { default.decodeFromString("""{"id":0-1}""", it) } - assertFailsWith { default.decodeFromString("""{"id":0-}""", it) } - assertFailsWith { default.decodeFromString("""{"id":a}""", it) } - assertFailsWith { default.decodeFromString("""{"id":-a}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":-}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":+}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":--}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":1-1}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":0-1}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":0-}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":a}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"id":-a}""", it) } } @@ -153,9 +152,9 @@ class JsonParserFailureModesTest : JsonTestBase() { @Test fun testUnexpectedNull() = parametrizedTest { - assertFailsWith { default.decodeFromString("""{"b":{"b":"b"}}""", it) } - assertFailsWith { default.decodeFromString("""{"b":null}""", it) } - assertFailsWith { default.decodeFromString("""{"s":{"s":"s"}}""", it) } - assertFailsWith { default.decodeFromString("""{"s":null}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"b":{"b":"b"}}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"b":null}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"s":{"s":"s"}}""", it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString("""{"s":null}""", it) } } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt similarity index 89% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt index 123214e21..8062f4dda 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt @@ -30,14 +30,14 @@ class JsonParserTest : JsonTestBase() { @Test fun testEmptyValue() { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { parse("""{"X": "foo", "Y"}""") } } @Test fun testIncorrectUnicodeEscape() { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { parse("""{"X": "\uDD1H"}""") } } @@ -83,18 +83,16 @@ class JsonParserTest : JsonTestBase() { } private fun testTrailingComma(content: String) { - val e = assertFailsWith { Json.parseToJsonElement(content) } - val msg = e.message!! - assertTrue(msg.contains("Unexpected trailing")) + assertFailsWithSerialMessage("JsonDecodingException", "Unexpected trailing") { Json.parseToJsonElement(content) } } @Test fun testUnclosedStringLiteral() { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { parse("\"") } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { parse("""{"id":"""") } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt similarity index 86% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt index 4b39308d4..a1714b6a2 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt @@ -1,19 +1,24 @@ /* - * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package kotlinx.serialization.json import kotlinx.serialization.* import kotlinx.serialization.json.internal.* +import kotlinx.serialization.json.okio.decodeFromOkio +import kotlinx.serialization.json.okio.encodeToOkio import kotlinx.serialization.modules.EmptySerializersModule import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.test.* import kotlin.test.assertEquals +import okio.* + enum class JsonTestingMode { STREAMING, TREE, + OKIO_STREAMS, JAVA_STREAMS; companion object { @@ -46,6 +51,11 @@ abstract class JsonTestBase { val tree = writeJson(value, serializer) encodeToString(tree) } + JsonTestingMode.OKIO_STREAMS -> { + val buffer = Buffer() + encodeToOkio(serializer, value, buffer) + buffer.readUtf8() + } } internal inline fun Json.decodeFromString(source: String, jsonTestingMode: JsonTestingMode): T { @@ -72,12 +82,19 @@ abstract class JsonTestBase { lexer.expectEof() readJson(tree, deserializer) } + JsonTestingMode.OKIO_STREAMS -> { + val buffer = Buffer() + buffer.writeUtf8(source) + decodeFromOkio(deserializer, buffer) + } } protected open fun parametrizedTest(test: (JsonTestingMode) -> Unit) { processResults(buildList { add(runCatching { test(JsonTestingMode.STREAMING) }) add(runCatching { test(JsonTestingMode.TREE) }) + add(runCatching { test(JsonTestingMode.OKIO_STREAMS) }) + if (isJvm()) { add(runCatching { test(JsonTestingMode.JAVA_STREAMS) }) } @@ -101,7 +118,8 @@ abstract class JsonTestBase { protected fun parametrizedTest(json: Json, test: StringFormat.() -> Unit) { val streamingResult = runCatching { SwitchableJson(json, JsonTestingMode.STREAMING).test() } val treeResult = runCatching { SwitchableJson(json, JsonTestingMode.TREE).test() } - processResults(listOf(streamingResult, treeResult)) + val okioResult = runCatching { SwitchableJson(json, JsonTestingMode.OKIO_STREAMS).test() } + processResults(listOf(streamingResult, treeResult, okioResult)) } protected fun processResults(results: List>) { diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt similarity index 94% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt index c46a11d51..ebe063138 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt @@ -8,6 +8,7 @@ package kotlinx.serialization.json import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import kotlinx.serialization.json.internal.* +import kotlinx.serialization.test.assertFailsWithSerial import kotlin.test.* class JsonTransientTest : JsonTestBase() { @@ -51,7 +52,7 @@ class JsonTransientTest : JsonTestBase() { @Test fun testThrowTransient() = parametrizedTest { jsonTestingMode -> - assertFailsWith(JsonDecodingException::class) { + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Data.serializer(), """{"a":0,"b":100500,"c":"Hello"}""", jsonTestingMode) } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeImplicitNullsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeImplicitNullsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeImplicitNullsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeImplicitNullsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt similarity index 99% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt index 3506e1f8b..6e600386b 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt @@ -7,7 +7,6 @@ package kotlinx.serialization.json import kotlinx.serialization.* import kotlinx.serialization.test.* import kotlin.test.* -import kotlin.test.assertTrue class JsonTreeTest : JsonTestBase() { @Serializable diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonUnicodeTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUnicodeTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonUnicodeTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUnicodeTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/LenientTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/LenientTest.kt similarity index 84% rename from formats/json/commonTest/src/kotlinx/serialization/json/LenientTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/LenientTest.kt index b89e853f6..41d3c2c20 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/LenientTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/LenientTest.kt @@ -7,6 +7,7 @@ package kotlinx.serialization.json import kotlinx.serialization.* import kotlinx.serialization.builtins.* import kotlinx.serialization.json.internal.* +import kotlinx.serialization.test.assertFailsWithSerial import kotlin.test.* class LenientTest : JsonTestBase() { @@ -36,28 +37,28 @@ class LenientTest : JsonTestBase() { @Test fun testQuotedBoolean() = parametrizedTest { val json = """{"i":1, "l":2, "b":"true", "s":"string"}""" - assertFailsWith { default.decodeFromString(Holder.serializer(), json, it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), json, it) } assertEquals(value, lenient.decodeFromString(Holder.serializer(), json, it)) } @Test fun testUnquotedStringValue() = parametrizedTest { val json = """{"i":1, "l":2, "b":true, "s":string}""" - assertFailsWith { default.decodeFromString(Holder.serializer(), json, it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), json, it) } assertEquals(value, lenient.decodeFromString(Holder.serializer(), json, it)) } @Test fun testUnquotedKey() = parametrizedTest { val json = """{"i":1, "l":2, b:true, "s":"string"}""" - assertFailsWith { default.decodeFromString(Holder.serializer(), json, it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(Holder.serializer(), json, it) } assertEquals(value, lenient.decodeFromString(Holder.serializer(), json, it)) } @Test fun testUnquotedStringInArray() = parametrizedTest { val json = """{"l":[1, 2, ss]}""" - assertFailsWith { default.decodeFromString(ListHolder.serializer(), json, it) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(ListHolder.serializer(), json, it) } assertEquals(listValue, lenient.decodeFromString(ListHolder.serializer(), json, it)) } @@ -68,7 +69,7 @@ class LenientTest : JsonTestBase() { fun testNullsProhibited() = parametrizedTest { assertEquals(StringWrapper("nul"), lenient.decodeFromString("""{"s":nul}""", it)) assertEquals(StringWrapper("null1"), lenient.decodeFromString("""{"s":null1}""", it)) - assertFailsWith { lenient.decodeFromString("""{"s":null}""", it) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString("""{"s":null}""", it) } } @Serializable diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt similarity index 82% rename from formats/json/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt index 745b0747b..fad07e620 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt @@ -47,11 +47,9 @@ class SpecialFloatingPointValuesTest : JsonTestBase() { } private fun test(box: Box, expected: String, jsonTestingMode: JsonTestingMode) { - val e1 = assertFailsWith { default.encodeToString(Box.serializer(), box, jsonTestingMode) } - assertTrue { e1.message!!.contains("Unexpected special floating-point value") } + assertFailsWithSerialMessage("JsonEncodingException", "Unexpected special floating-point value") { default.encodeToString(Box.serializer(), box, jsonTestingMode) } assertEquals(expected, json.encodeToString(Box.serializer(), box, jsonTestingMode)) assertEquals(box, json.decodeFromString(Box.serializer(), expected, jsonTestingMode)) - val e2 = assertFailsWith { default.decodeFromString(Box.serializer(), expected, jsonTestingMode) } - assertTrue { e2.message!!.contains("Unexpected special floating-point value") } + assertFailsWithSerialMessage("JsonDecodingException", "Unexpected special floating-point value") { default.decodeFromString(Box.serializer(), expected, jsonTestingMode) } } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt similarity index 88% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt index 13e92316d..b7d4f1226 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.* import kotlinx.serialization.json.* import kotlinx.serialization.json.internal.* import kotlinx.serialization.modules.* +import kotlinx.serialization.test.assertFailsWithSerial import kotlin.test.* class JsonPolymorphismExceptionTest : JsonTestBase() { @@ -30,7 +31,7 @@ class JsonPolymorphismExceptionTest : JsonTestBase() { } } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { Json { serializersModule = serialModule }.decodeFromString(Base.serializer(), """{"type":"derived","nested":null}""", jsonTestingMode) } } @@ -43,7 +44,7 @@ class JsonPolymorphismExceptionTest : JsonTestBase() { } } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { Json { serializersModule = serialModule }.decodeFromString(Base.serializer(), """{"nested":{}}""", jsonTestingMode) } } diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt similarity index 84% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt index ba4672a13..266e9e975 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt @@ -5,7 +5,6 @@ package kotlinx.serialization.json.serializers import kotlinx.serialization.json.* -import kotlinx.serialization.json.internal.* import kotlinx.serialization.test.* import kotlin.test.* @@ -27,20 +26,20 @@ class JsonArraySerializerTest : JsonTestBase() { @Test fun testTopLevelJsonObjectAsElement() = parametrizedTest(default) { - assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonElementSerializer) + assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonElement.serializer()) } @Test fun testJsonArrayToString() { val prebuiltJson = prebuiltJson() - val string = lenient.encodeToString(JsonArraySerializer, prebuiltJson) + val string = lenient.encodeToString(JsonArray.serializer(), prebuiltJson) assertEquals(string, prebuiltJson.toString()) } @Test fun testMixedLiterals() = parametrizedTest { jsonTestingMode -> val json = """[1, "2", 3, "4"]""" - val array = default.decodeFromString(JsonArraySerializer, json, jsonTestingMode) + val array = default.decodeFromString(JsonArray.serializer(), json, jsonTestingMode) array.forEachIndexed { index, element -> require(element is JsonLiteral) assertEquals(index % 2 == 1, element.isString) @@ -58,17 +57,17 @@ class JsonArraySerializerTest : JsonTestBase() { @Test fun testEmptyArray() = parametrizedTest { jsonTestingMode -> - assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArraySerializer, "[]", jsonTestingMode)) - assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArraySerializer, "[ ]", jsonTestingMode)) - assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArraySerializer, "[\n\n]", jsonTestingMode)) - assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArraySerializer, "[ \t]", jsonTestingMode)) + assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArray.serializer(), "[]", jsonTestingMode)) + assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArray.serializer(), "[ ]", jsonTestingMode)) + assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArray.serializer(), "[\n\n]", jsonTestingMode)) + assertEquals(JsonArray(emptyList()), lenient.decodeFromString(JsonArray.serializer(), "[ \t]", jsonTestingMode)) } @Test fun testWhitespaces() = parametrizedTest { jsonTestingMode -> assertEquals( JsonArray(listOf(1, 2, 3, 4, 5).map(::JsonPrimitive)), - lenient.decodeFromString(JsonArraySerializer, "[1, 2, 3, \n 4, 5]", jsonTestingMode) + lenient.decodeFromString(JsonArray.serializer(), "[1, 2, 3, \n 4, 5]", jsonTestingMode) ) } @@ -89,9 +88,9 @@ class JsonArraySerializerTest : JsonTestBase() { } private fun testFails(input: String, errorMessage: String, jsonTestingMode: JsonTestingMode) { - assertFailsWithMessage(errorMessage) { + assertFailsWithSerial("JsonDecodingException", errorMessage) { lenient.decodeFromString( - JsonArraySerializer, + JsonArray.serializer(), input, jsonTestingMode ) diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt similarity index 69% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt index 83de5928c..934afcacc 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt @@ -5,7 +5,7 @@ package kotlinx.serialization.json.serializers import kotlinx.serialization.json.* -import kotlinx.serialization.json.internal.* +import kotlinx.serialization.test.assertFailsWithSerialMessage import kotlinx.serialization.test.assertStringFormAndRestored import kotlin.test.* @@ -18,8 +18,7 @@ class JsonNullSerializerTest : JsonTestBase() { @Test fun testJsonNullFailure() = parametrizedTest(default) { - val t = assertFailsWith { default.decodeFromString(JsonNullWrapper.serializer(), "{\"element\":\"foo\"}", JsonTestingMode.STREAMING) } - assertTrue { t.message!!.contains("'null' literal") } + assertFailsWithSerialMessage("JsonDecodingException", "'null' literal") { default.decodeFromString(JsonNullWrapper.serializer(), "{\"element\":\"foo\"}", JsonTestingMode.STREAMING) } } @Test @@ -34,28 +33,28 @@ class JsonNullSerializerTest : JsonTestBase() { @Test fun testTopLevelJsonNull() = parametrizedTest { jsonTestingMode -> - val string = default.encodeToString(JsonNullSerializer, JsonNull, jsonTestingMode) + val string = default.encodeToString(JsonNull.serializer(), JsonNull, jsonTestingMode) assertEquals("null", string) - assertEquals(JsonNull, default.decodeFromString(JsonNullSerializer, string, jsonTestingMode)) + assertEquals(JsonNull, default.decodeFromString(JsonNull.serializer(), string, jsonTestingMode)) } @Test fun testTopLevelJsonNullAsElement() = parametrizedTest { jsonTestingMode -> - val string = default.encodeToString(JsonElementSerializer, JsonNull, jsonTestingMode) + val string = default.encodeToString(JsonElement.serializer(), JsonNull, jsonTestingMode) assertEquals("null", string) - assertEquals(JsonNull, default.decodeFromString(JsonElementSerializer, string, jsonTestingMode)) + assertEquals(JsonNull, default.decodeFromString(JsonElement.serializer(), string, jsonTestingMode)) } @Test fun testTopLevelJsonNullAsPrimitive() = parametrizedTest { jsonTestingMode -> - val string = default.encodeToString(JsonPrimitiveSerializer, JsonNull, jsonTestingMode) + val string = default.encodeToString(JsonPrimitive.serializer(), JsonNull, jsonTestingMode) assertEquals("null", string) - assertEquals(JsonNull, default.decodeFromString(JsonPrimitiveSerializer, string, jsonTestingMode)) + assertEquals(JsonNull, default.decodeFromString(JsonPrimitive.serializer(), string, jsonTestingMode)) } @Test fun testJsonNullToString() { - val string = default.encodeToString(JsonPrimitiveSerializer, JsonNull) + val string = default.encodeToString(JsonPrimitive.serializer(), JsonNull) assertEquals(string, JsonNull.toString()) } } diff --git a/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt new file mode 100644 index 000000000..9a65effe2 --- /dev/null +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt @@ -0,0 +1,125 @@ +/* + * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.serialization.json.serializers + +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.* +import kotlinx.serialization.json.internal.* +import kotlinx.serialization.test.* +import kotlin.test.* + +class JsonObjectSerializerTest : JsonTestBase() { + + private val expected = """{"element":{"literal":1,"nullKey":null,"nested":{"another literal":"some value"},"\\. escaped":"\\. escaped","\n new line":"\n new line"}}""" + private val expectedTopLevel = """{"literal":1,"nullKey":null,"nested":{"another literal":"some value"},"\\. escaped":"\\. escaped","\n new line":"\n new line"}""" + + @Test + fun testJsonObject() = parametrizedTest(default) { + assertStringFormAndRestored(expected, JsonObjectWrapper(prebuiltJson()), JsonObjectWrapper.serializer()) + } + + @Test + fun testJsonObjectAsElement() = parametrizedTest(default) { + assertStringFormAndRestored(expected, JsonElementWrapper(prebuiltJson()), JsonElementWrapper.serializer()) + } + + @Test + fun testTopLevelJsonObject() = parametrizedTest (default) { + assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonObject.serializer()) + } + + @Test + fun testTopLevelJsonObjectAsElement() = parametrizedTest (default) { + assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonElement.serializer()) + } + + @Test + fun testJsonObjectToString() { + val prebuiltJson = prebuiltJson() + val string = lenient.encodeToString(JsonElement.serializer(), prebuiltJson) + assertEquals(string, prebuiltJson.toString()) + } + + @Test + fun testDocumentationSample() { + val string = Json.encodeToString(JsonElement.serializer(), buildJsonObject { put("key", 1.0) }) + val literal = Json.decodeFromString(JsonElement.serializer(), string) + assertEquals(JsonObject(mapOf("key" to JsonPrimitive(1.0))), literal) + } + + @Test + fun testMissingCommas() = parametrizedTest { jsonTestingMode -> + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{ \"1\": \"2\" \"3\":\"4\"}", jsonTestingMode) } + } + + @Test + fun testEmptyObject() = parametrizedTest { jsonTestingMode -> + assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObject.serializer(), "{}", jsonTestingMode)) + assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObject.serializer(), "{}", jsonTestingMode)) + assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObject.serializer(), "{\n\n}", jsonTestingMode)) + assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObject.serializer(), "{ \t}", jsonTestingMode)) + } + + @Test + fun testInvalidObject() = parametrizedTest { jsonTestingMode -> + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(JsonObject.serializer(), "{\"a\":\"b\"]", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(JsonObject.serializer(), "{", jsonTestingMode) } + if (jsonTestingMode != JsonTestingMode.JAVA_STREAMS) // Streams support dangling characters + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(JsonObject.serializer(), "{}}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { default.decodeFromString(JsonObject.serializer(), "{]", jsonTestingMode) } + } + + @Test + fun testWhitespaces() = parametrizedTest { jsonTestingMode -> + assertEquals( + JsonObject(mapOf("1" to JsonPrimitive(2), "3" to JsonPrimitive(4), "5" to JsonPrimitive(6))), + lenient.decodeFromString(JsonObject.serializer(), "{1: 2, 3: \n 4, 5:6}", jsonTestingMode) + ) + } + + @Test + fun testExcessiveCommas() = parametrizedTest { jsonTestingMode -> + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{\"a\":\"b\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{\"a\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,\"1\":\"2\"}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,\"1\":\"2\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,,\"1\":\"2\"}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{\"1\":\"2\",,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{\"1\":\"2\",,\"2\":\"2\"}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{, ,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(JsonObject.serializer(), "{,\n,}", jsonTestingMode) } + } + + @Serializable + data class Holder(val a: String) + + @Test + fun testExcessiveCommasInObject() = parametrizedTest { jsonTestingMode -> + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{\"a\":\"b\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{\"a\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,\"a\":\"b\"}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,\"a\":\"b\",}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,,\"a\":\"b\"}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{\"a\":\"b\",,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{, ,}", jsonTestingMode) } + assertFailsWithSerial("JsonDecodingException") { lenient.decodeFromString(Holder.serializer(), "{,\n,}", jsonTestingMode) } + } + + private fun prebuiltJson(): JsonObject { + return buildJsonObject { + put("literal", 1) + put("nullKey", JsonNull) + putJsonObject("nested") { + put("another literal", "some value") + } + put("\\. escaped", "\\. escaped") + put("\n new line", "\n new line") + } + } +} diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt similarity index 87% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt index 789fb2ca9..dfa7f4c7f 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt @@ -48,30 +48,30 @@ class JsonPrimitiveSerializerTest : JsonTestBase() { @Test fun testTopLevelPrimitive() = parametrizedTest { jsonTestingMode -> - val string = default.encodeToString(JsonPrimitiveSerializer, JsonPrimitive(42), jsonTestingMode) + val string = default.encodeToString(JsonPrimitive.serializer(), JsonPrimitive(42), jsonTestingMode) assertEquals("42", string) - assertEquals(JsonPrimitive(42), default.decodeFromString(JsonPrimitiveSerializer, string)) + assertEquals(JsonPrimitive(42), default.decodeFromString(JsonPrimitive.serializer(), string)) } @Test fun testTopLevelPrimitiveAsElement() = parametrizedTest { jsonTestingMode -> if (isJs()) return@parametrizedTest // JS toString numbers - val string = default.encodeToString(JsonElementSerializer, JsonPrimitive(1.3), jsonTestingMode) + val string = default.encodeToString(JsonElement.serializer(), JsonPrimitive(1.3), jsonTestingMode) assertEquals("1.3", string) - assertEquals(JsonPrimitive(1.3), default.decodeFromString(JsonElementSerializer, string, jsonTestingMode)) + assertEquals(JsonPrimitive(1.3), default.decodeFromString(JsonElement.serializer(), string, jsonTestingMode)) } @Test fun testJsonLiteralStringToString() { val literal = JsonPrimitive("some string literal") - val string = default.encodeToString(JsonPrimitiveSerializer, literal) + val string = default.encodeToString(JsonPrimitive.serializer(), literal) assertEquals(string, literal.toString()) } @Test fun testJsonLiteralIntToString() { val literal = JsonPrimitive(0) - val string = default.encodeToString(JsonPrimitiveSerializer, literal) + val string = default.encodeToString(JsonPrimitive.serializer(), literal) assertEquals(string, literal.toString()) } @@ -93,7 +93,7 @@ class JsonPrimitiveSerializerTest : JsonTestBase() { private fun testLiteral(number: Number, jvmExpectedString: String) { val literal = JsonPrimitive(number) - val string = default.encodeToString(JsonPrimitiveSerializer, literal) + val string = default.encodeToString(JsonPrimitive.serializer(), literal) assertEquals(string, literal.toString()) if (isJvm()) { // We can rely on stable double/float format only on JVM assertEquals(string, jvmExpectedString) diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt similarity index 99% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt index 00a78a21d..dd4d51ef3 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt @@ -9,7 +9,7 @@ import kotlin.test.* class JsonTreeTest : JsonTestBase() { - private fun parse(input: String): JsonElement = default.decodeFromString(JsonElementSerializer, input) + private fun parse(input: String): JsonElement = default.decodeFromString(JsonElement.serializer(), input) @Test fun testParseWithoutExceptions() { diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/ContextualTest.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/ContextualTest.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/ContextualTest.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/ContextualTest.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/JsonHelpers.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/JsonHelpers.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/JsonHelpers.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/JsonHelpers.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/TestHelpers.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/TestHelpers.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/TestHelpers.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/TestHelpers.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/TestId.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/TestId.kt similarity index 100% rename from formats/json/commonTest/src/kotlinx/serialization/test/TestId.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/TestId.kt diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/TestingFramework.kt b/formats/json-tests/commonTest/src/kotlinx/serialization/test/TestingFramework.kt similarity index 68% rename from formats/json/commonTest/src/kotlinx/serialization/test/TestingFramework.kt rename to formats/json-tests/commonTest/src/kotlinx/serialization/test/TestingFramework.kt index 064828a8b..093763a2f 100644 --- a/formats/json/commonTest/src/kotlinx/serialization/test/TestingFramework.kt +++ b/formats/json-tests/commonTest/src/kotlinx/serialization/test/TestingFramework.kt @@ -52,6 +52,35 @@ fun assertSerializedAndRestored( assertEquals(original, restored) } +inline fun assertFailsWithSerial( + exceptionName: String, + assertionMessage: String? = null, + block: () -> Unit +) { + val exception = assertFailsWith(SerializationException::class, assertionMessage, block) + assertEquals( + exceptionName, + exception::class.simpleName, + "Expected exception with type '${exceptionName}' but got '${exception::class.simpleName}'" + ) +} +inline fun assertFailsWithSerialMessage( + exceptionName: String, + message: String, + assertionMessage: String? = null, + block: () -> Unit +) { + val exception = assertFailsWith(SerializationException::class, assertionMessage, block) + assertEquals( + exceptionName, + exception::class.simpleName, + "Expected message '${exception.message}' to contain substring '$message'" + ) + assertTrue( + exception.message!!.contains(message), + "Expected message '${exception.message}' to contain substring '$message'" + ) +} inline fun assertFailsWithMessage( message: String, assertionMessage: String? = null, diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicSpecialCasesTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicSpecialCasesTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicSpecialCasesTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicSpecialCasesTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/DecodeFromDynamicTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/DynamicPolymorphismTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/DynamicPolymorphismTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/DynamicPolymorphismTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/DynamicPolymorphismTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt similarity index 92% rename from formats/json/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt index ead189697..e41906443 100644 --- a/formats/json/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt +++ b/formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicSpecialCasesTest.kt @@ -4,13 +4,8 @@ package kotlinx.serialization.json -import kotlinx.serialization.descriptors.* -import kotlinx.serialization.encoding.* import kotlinx.serialization.* -import kotlinx.serialization.modules.* -import kotlinx.serialization.test.* import kotlin.test.* -import kotlin.test.assertFailsWith class EncodeToDynamicSpecialCasesTest { diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/JsonCoerceInputValuesDynamicTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonCoerceInputValuesDynamicTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/JsonCoerceInputValuesDynamicTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonCoerceInputValuesDynamicTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/JsonDynamicImplicitNullsTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonDynamicImplicitNullsTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/JsonDynamicImplicitNullsTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonDynamicImplicitNullsTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/json/JsonNamesDynamicTest.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonNamesDynamicTest.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/json/JsonNamesDynamicTest.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/json/JsonNamesDynamicTest.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt diff --git a/formats/json/jsTest/src/kotlinx/serialization/test/JsonHelpers.kt b/formats/json-tests/jsTest/src/kotlinx/serialization/test/JsonHelpers.kt similarity index 100% rename from formats/json/jsTest/src/kotlinx/serialization/test/JsonHelpers.kt rename to formats/json-tests/jsTest/src/kotlinx/serialization/test/JsonHelpers.kt diff --git a/formats/json/jvmTest/resources/corner_cases/listing.txt b/formats/json-tests/jvmTest/resources/corner_cases/listing.txt similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/listing.txt rename to formats/json-tests/jvmTest/resources/corner_cases/listing.txt diff --git a/formats/json/jvmTest/resources/corner_cases/number_1.0.json b/formats/json-tests/jvmTest/resources/corner_cases/number_1.0.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_1.0.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_1.0.json diff --git a/formats/json/jvmTest/resources/corner_cases/number_1.000000000000000005.json b/formats/json-tests/jvmTest/resources/corner_cases/number_1.000000000000000005.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_1.000000000000000005.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_1.000000000000000005.json diff --git a/formats/json/jvmTest/resources/corner_cases/number_1000000000000000.json b/formats/json-tests/jvmTest/resources/corner_cases/number_1000000000000000.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_1000000000000000.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_1000000000000000.json diff --git a/formats/json/jvmTest/resources/corner_cases/number_10000000000000000999.json b/formats/json-tests/jvmTest/resources/corner_cases/number_10000000000000000999.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_10000000000000000999.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_10000000000000000999.json diff --git a/formats/json/jvmTest/resources/corner_cases/number_1e-999.json b/formats/json-tests/jvmTest/resources/corner_cases/number_1e-999.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_1e-999.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_1e-999.json diff --git a/formats/json/jvmTest/resources/corner_cases/number_1e6.json b/formats/json-tests/jvmTest/resources/corner_cases/number_1e6.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/number_1e6.json rename to formats/json-tests/jvmTest/resources/corner_cases/number_1e6.json diff --git a/formats/json/jvmTest/resources/corner_cases/object_key_nfc_nfd.json b/formats/json-tests/jvmTest/resources/corner_cases/object_key_nfc_nfd.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/object_key_nfc_nfd.json rename to formats/json-tests/jvmTest/resources/corner_cases/object_key_nfc_nfd.json diff --git a/formats/json/jvmTest/resources/corner_cases/object_key_nfd_nfc.json b/formats/json-tests/jvmTest/resources/corner_cases/object_key_nfd_nfc.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/object_key_nfd_nfc.json rename to formats/json-tests/jvmTest/resources/corner_cases/object_key_nfd_nfc.json diff --git a/formats/json/jvmTest/resources/corner_cases/object_same_key_different_values.json b/formats/json-tests/jvmTest/resources/corner_cases/object_same_key_different_values.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/object_same_key_different_values.json rename to formats/json-tests/jvmTest/resources/corner_cases/object_same_key_different_values.json diff --git a/formats/json/jvmTest/resources/corner_cases/object_same_key_same_value.json b/formats/json-tests/jvmTest/resources/corner_cases/object_same_key_same_value.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/object_same_key_same_value.json rename to formats/json-tests/jvmTest/resources/corner_cases/object_same_key_same_value.json diff --git a/formats/json/jvmTest/resources/corner_cases/object_same_key_unclear_values.json b/formats/json-tests/jvmTest/resources/corner_cases/object_same_key_unclear_values.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/object_same_key_unclear_values.json rename to formats/json-tests/jvmTest/resources/corner_cases/object_same_key_unclear_values.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json b/formats/json-tests/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json b/formats/json-tests/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json b/formats/json-tests/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json b/formats/json-tests/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json b/formats/json-tests/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json b/formats/json-tests/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json diff --git a/formats/json/jvmTest/resources/corner_cases/string_with_escaped_NULL.json b/formats/json-tests/jvmTest/resources/corner_cases/string_with_escaped_NULL.json similarity index 100% rename from formats/json/jvmTest/resources/corner_cases/string_with_escaped_NULL.json rename to formats/json-tests/jvmTest/resources/corner_cases/string_with_escaped_NULL.json diff --git a/formats/json/jvmTest/resources/corpus.zip b/formats/json-tests/jvmTest/resources/corpus.zip similarity index 100% rename from formats/json/jvmTest/resources/corpus.zip rename to formats/json-tests/jvmTest/resources/corpus.zip diff --git a/formats/json/jvmTest/resources/spec_cases/listing.txt b/formats/json-tests/jvmTest/resources/spec_cases/listing.txt similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/listing.txt rename to formats/json-tests/jvmTest/resources/spec_cases/listing.txt diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_comma_after_close.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_comma_after_close.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_comma_after_close.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_comma_after_close.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_comma_and_number.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_comma_and_number.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_comma_and_number.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_comma_and_number.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_double_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_double_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_double_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_double_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_double_extra_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_double_extra_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_double_extra_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_double_extra_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_extra_close.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_extra_close.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_extra_close.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_extra_close.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_extra_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_extra_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_extra_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_extra_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_incomplete.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_incomplete.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_incomplete.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_incomplete.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_invalid_utf8.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_invalid_utf8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_invalid_utf8.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_invalid_utf8.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_just_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_just_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_just_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_just_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_just_minus.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_just_minus.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_just_minus.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_just_minus.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_missing_value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_missing_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_missing_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_missing_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_number_and_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_number_and_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_number_and_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_number_and_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_star_inside.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_star_inside.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_star_inside.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_star_inside.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_unclosed.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_unclosed.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json b/formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_incomplete_false.json b/formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_false.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_incomplete_false.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_false.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_incomplete_null.json b/formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_incomplete_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_incomplete_true.json b/formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_true.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_incomplete_true.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_incomplete_true.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json b/formats/json-tests/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_bad_value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_bad_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_bad_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_bad_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_bracket_key.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_bracket_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_bracket_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_bracket_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_double_colon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_double_colon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_double_colon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_double_colon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_emoji.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_emoji.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_emoji.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_emoji.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_garbage_at_end.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_garbage_at_end.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_garbage_at_end.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_garbage_at_end.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_missing_colon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_colon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_missing_colon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_colon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_missing_key.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_missing_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_missing_semicolon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_semicolon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_missing_semicolon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_semicolon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_missing_value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_missing_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_missing_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_no-colon.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_no-colon.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_no-colon.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_no-colon.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_non_string_key.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_non_string_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_non_string_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_non_string_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_repeated_null_null.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_repeated_null_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_repeated_null_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_repeated_null_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_single_quote.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_single_quote.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_single_quote.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_single_quote.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_trailing_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_unquoted_key.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_unquoted_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_unquoted_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_unquoted_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_unterminated-value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_unterminated-value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_unterminated-value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_unterminated-value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_with_single_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_with_single_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_with_single_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_with_single_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json b/formats/json-tests/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_single_space.json b/formats/json-tests/jvmTest/resources/spec_cases/n_single_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_single_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_single_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_backslash_00.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_backslash_00.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_backslash_00.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_backslash_00.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_escape_x.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_escape_x.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_escape_x.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_escape_x.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_escaped_emoji.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_emoji.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_escaped_emoji.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_escaped_emoji.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_single_doublequote.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_single_doublequote.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_single_doublequote.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_single_doublequote.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_single_quote.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_single_quote.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_single_quote.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_single_quote.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_newline.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_newline.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_unescaped_newline.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_newline.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_tab.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_tab.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_unescaped_tab.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_unescaped_tab.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json b/formats/json-tests/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_capitalized_True.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_capitalized_True.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_capitalized_True.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_capitalized_True.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_double_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_double_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_double_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_double_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_end_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_end_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_end_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_end_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_no_data.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_no_data.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_no_data.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_no_data.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_object_with_comment.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_with_comment.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_object_with_comment.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_with_comment.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_object.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_array_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_array_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_comma.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_comma.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object_comma.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_comma.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_open_open.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_open.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_open_open.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_open_open.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_single_star.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_single_star.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_single_star.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_single_star.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_trailing_#.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_trailing_#.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_trailing_#.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_trailing_#.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_object.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unclosed_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json diff --git a/formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json b/formats/json-tests/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json rename to formats/json-tests/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_empty-string.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_empty-string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_empty-string.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_empty-string.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_empty.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_empty.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_empty.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_empty.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_ending_with_newline.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_ending_with_newline.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_ending_with_newline.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_ending_with_newline.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_false.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_false.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_false.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_false.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_heterogeneous.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_heterogeneous.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_heterogeneous.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_heterogeneous.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_null.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_with_leading_space.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_with_leading_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_with_leading_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_with_leading_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_with_several_null.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_with_several_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_with_several_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_with_several_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_array_with_trailing_space.json b/formats/json-tests/jvmTest/resources/spec_cases/y_array_with_trailing_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_array_with_trailing_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_array_with_trailing_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_0e+1.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_0e+1.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_0e+1.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_0e+1.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_0e1.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_0e1.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_0e1.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_0e1.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_after_space.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_after_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_after_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_after_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_int_with_exp.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_int_with_exp.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_int_with_exp.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_int_with_exp.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_minus_zero.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_minus_zero.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_minus_zero.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_minus_zero.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_negative_int.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_int.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_negative_int.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_int.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_negative_one.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_one.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_negative_one.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_one.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_negative_zero.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_zero.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_negative_zero.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_negative_zero.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_exponent.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_exponent.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_exponent.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_exponent.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_neg_exp.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_neg_exp.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_neg_exp.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_neg_exp.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_simple_int.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_simple_int.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_simple_int.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_simple_int.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_number_simple_real.json b/formats/json-tests/jvmTest/resources/spec_cases/y_number_simple_real.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_number_simple_real.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_number_simple_real.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_basic.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_basic.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_basic.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_basic.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_duplicated_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_duplicated_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_empty.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_empty.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_empty.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_empty.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_empty_key.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_empty_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_empty_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_empty_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_extreme_numbers.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_extreme_numbers.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_extreme_numbers.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_extreme_numbers.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_long_strings.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_long_strings.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_long_strings.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_long_strings.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_simple.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_simple.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_simple.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_simple.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_string_unicode.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_string_unicode.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_string_unicode.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_string_unicode.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_object_with_newlines.json b/formats/json-tests/jvmTest/resources/spec_cases/y_object_with_newlines.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_object_with_newlines.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_object_with_newlines.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_allowed_escapes.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_allowed_escapes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_allowed_escapes.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_allowed_escapes.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_comments.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_comments.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_comments.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_comments.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_double_escape_a.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_double_escape_a.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_double_escape_a.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_double_escape_a.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_double_escape_n.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_double_escape_n.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_double_escape_n.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_double_escape_n.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_escaped_control_character.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_escaped_control_character.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_escaped_control_character.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_escaped_control_character.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_in_array.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_in_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_in_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_in_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_null_escape.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_null_escape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_null_escape.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_null_escape.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_pi.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_pi.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_pi.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_pi.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_simple_ascii.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_simple_ascii.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_simple_ascii.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_simple_ascii.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_space.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_space.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_space.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_space.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_uEscape.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_uEscape.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_uEscape.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_uEscape.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_uescaped_newline.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_uescaped_newline.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_uescaped_newline.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_uescaped_newline.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_2.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_2.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_2.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_2.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_utf8.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_utf8.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_utf8.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_utf8.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_string_with_del_character.json b/formats/json-tests/jvmTest/resources/spec_cases/y_string_with_del_character.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_string_with_del_character.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_string_with_del_character.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_false.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_false.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_false.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_false.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_int.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_int.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_int.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_int.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_null.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_null.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_null.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_null.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_string.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_string.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_string.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_string.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_true.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_true.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_lonely_true.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_lonely_true.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_string_empty.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_string_empty.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_string_empty.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_string_empty.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_trailing_newline.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_trailing_newline.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_trailing_newline.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_trailing_newline.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_true_in_array.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_true_in_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_true_in_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_true_in_array.json diff --git a/formats/json/jvmTest/resources/spec_cases/y_structure_whitespace_array.json b/formats/json-tests/jvmTest/resources/spec_cases/y_structure_whitespace_array.json similarity index 100% rename from formats/json/jvmTest/resources/spec_cases/y_structure_whitespace_array.json rename to formats/json-tests/jvmTest/resources/spec_cases/y_structure_whitespace_array.json diff --git a/formats/json/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt similarity index 99% rename from formats/json/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt index b932b5aee..5fc366a9e 100644 --- a/formats/json/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt +++ b/formats/json-tests/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt @@ -5,7 +5,6 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.modules.polymorphic import kotlinx.serialization.modules.subclass -import org.junit.Ignore import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertTrue diff --git a/formats/json/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt similarity index 98% rename from formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt index db79b4779..3d634fcaf 100644 --- a/formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt +++ b/formats/json-tests/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt @@ -4,7 +4,6 @@ package kotlinx.serialization -import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* import kotlinx.serialization.json.Json diff --git a/formats/json/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt similarity index 76% rename from formats/json/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt index e6fbecb9c..1a40d8b51 100644 --- a/formats/json/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt +++ b/formats/json-tests/jvmTest/src/kotlinx/serialization/StacktraceRecoveryTest.kt @@ -22,12 +22,12 @@ class StacktraceRecoveryTest { } @Test - fun testJsonDecodingException() = checkRecovered { + fun testJsonDecodingException() = checkRecovered("JsonDecodingException") { Json.decodeFromString("42") } @Test - fun testJsonEncodingException() = checkRecovered { + fun testJsonEncodingException() = checkRecovered("JsonEncodingException") { Json.encodeToString(Double.NaN) } @@ -57,19 +57,6 @@ class StacktraceRecoveryTest { assertEquals(exceptionClassSimpleName, e::class.simpleName!!) } - private inline fun checkRecovered(noinline block: () -> Unit) = runBlocking { - val result = runCatching { - callBlockWithRecovery(block) - } - assertTrue(result.isFailure, "Block should have failed") - val e = result.exceptionOrNull()!! - assertEquals(E::class, e::class) - val cause = e.cause - assertNotNull(cause, "Exception should have cause: $e") - assertEquals(e.message, cause.message) - assertEquals(E::class, cause::class) - } - // KLUDGE: A separate function with state-machine to ensure coroutine DebugMetadata is generated. See KT-41789 private suspend fun callBlockWithRecovery(block: () -> Unit) { yield() diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/JsonJvmStreamsTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonJvmStreamsTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/features/JsonJvmStreamsTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonJvmStreamsTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt similarity index 95% rename from formats/json/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt index aad9a0f51..f6d13f702 100644 --- a/formats/json/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt +++ b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonLazySequenceTest.kt @@ -12,8 +12,8 @@ import kotlinx.serialization.builtins.serializer import kotlinx.serialization.features.sealed.SealedChild import kotlinx.serialization.features.sealed.SealedParent import kotlinx.serialization.json.* -import kotlinx.serialization.json.internal.JsonDecodingException import kotlinx.serialization.test.assertFailsWithMessage +import kotlinx.serialization.test.assertFailsWithSerial import org.junit.Test import java.io.* import kotlin.test.* @@ -142,7 +142,7 @@ class JsonLazySequenceTest { val input2 = """[1, 2, 3]qwert""" val input3 = """[1,2 3]""" withInputs(input1, input2, input3) { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { json.decodeToSequence(it, Int.serializer()).toList() } } @@ -151,13 +151,13 @@ class JsonLazySequenceTest { @Test fun testMultilineArrays() { val input = "[1,2,3]\n[4,5,6]\n[7,8,9]" - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { json.decodeToSequence>(input.asInputStream(), DecodeSequenceMode.AUTO_DETECT).toList() } - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { json.decodeToSequence(input.asInputStream(), DecodeSequenceMode.AUTO_DETECT).toList() } - assertFailsWith { // we do not merge lists + assertFailsWithSerial("JsonDecodingException") { // we do not merge lists json.decodeToSequence(input.asInputStream(), DecodeSequenceMode.ARRAY_WRAPPED).toList() } val parsed = json.decodeToSequence>(input.asInputStream(), DecodeSequenceMode.WHITESPACE_SEPARATED).toList() @@ -167,7 +167,7 @@ class JsonLazySequenceTest { @Test fun testStrictArrayCheck() { - assertFailsWith { + assertFailsWithSerial("JsonDecodingException") { json.decodeToSequence(inputStringWsSeparated.asInputStream(), DecodeSequenceMode.ARRAY_WRAPPED) } } diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt similarity index 73% rename from formats/json/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt index 287e44388..397caffdf 100644 --- a/formats/json/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt +++ b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/JsonSequencePathTest.kt @@ -4,20 +4,12 @@ package kotlinx.serialization.features -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.* -import kotlinx.coroutines.runBlocking import kotlinx.serialization.* import kotlinx.serialization.Serializable -import kotlinx.serialization.builtins.serializer -import kotlinx.serialization.features.sealed.SealedChild -import kotlinx.serialization.features.sealed.SealedParent import kotlinx.serialization.json.* -import kotlinx.serialization.json.internal.JsonDecodingException import kotlinx.serialization.test.assertFailsWithMessage import org.junit.Test import java.io.* -import kotlin.test.* class JsonSequencePathTest { diff --git a/formats/json/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/json/ParallelJsonStressTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/json/ParallelJsonStressTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/json/ParallelJsonStressTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/json/ParallelJsonStressTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt diff --git a/formats/json/jvmTest/src/kotlinx/serialization/test/JsonHelpers.kt b/formats/json-tests/jvmTest/src/kotlinx/serialization/test/JsonHelpers.kt similarity index 100% rename from formats/json/jvmTest/src/kotlinx/serialization/test/JsonHelpers.kt rename to formats/json-tests/jvmTest/src/kotlinx/serialization/test/JsonHelpers.kt diff --git a/formats/json/nativeTest/src/kotlinx/serialization/json/MultiWorkerJsonTest.kt b/formats/json-tests/nativeTest/src/kotlinx/serialization/json/MultiWorkerJsonTest.kt similarity index 100% rename from formats/json/nativeTest/src/kotlinx/serialization/json/MultiWorkerJsonTest.kt rename to formats/json-tests/nativeTest/src/kotlinx/serialization/json/MultiWorkerJsonTest.kt diff --git a/formats/json/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json-tests/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt similarity index 100% rename from formats/json/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt rename to formats/json-tests/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt diff --git a/formats/json/nativeTest/src/kotlinx/serialization/test/JsonHelpers.kt b/formats/json-tests/nativeTest/src/kotlinx/serialization/test/JsonHelpers.kt similarity index 100% rename from formats/json/nativeTest/src/kotlinx/serialization/test/JsonHelpers.kt rename to formats/json-tests/nativeTest/src/kotlinx/serialization/test/JsonHelpers.kt diff --git a/formats/json/api/kotlinx-serialization-json.api b/formats/json/api/kotlinx-serialization-json.api index e5449d9ba..1b1a82691 100644 --- a/formats/json/api/kotlinx-serialization-json.api +++ b/formats/json/api/kotlinx-serialization-json.api @@ -229,6 +229,14 @@ public final class kotlinx/serialization/json/JsonKt { public static synthetic fun Json$default (Lkotlinx/serialization/json/Json;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/serialization/json/Json; } +public final class kotlinx/serialization/json/JsonLiteral : kotlinx/serialization/json/JsonPrimitive { + public fun equals (Ljava/lang/Object;)Z + public fun getContent ()Ljava/lang/String; + public fun hashCode ()I + public fun isString ()Z + public fun toString ()Ljava/lang/String; +} + public abstract interface annotation class kotlinx/serialization/json/JsonNames : java/lang/annotation/Annotation { public abstract fun names ()[Ljava/lang/String; } @@ -355,6 +363,24 @@ public final class kotlinx/serialization/json/JvmStreamsKt { public static final fun encodeToStream (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;Ljava/io/OutputStream;)V } +public abstract class kotlinx/serialization/json/internal/AbstractJsonLexer { + protected field currentPosition I + public fun ()V + protected fun appendRange (II)V + protected final fun consumeString (Ljava/lang/CharSequence;II)Ljava/lang/String; + public final fun expectEof ()V + protected final fun getEscapedString ()Ljava/lang/StringBuilder; + protected abstract fun getSource ()Ljava/lang/CharSequence; + protected final fun isValidValueStart (C)Z + protected final fun setEscapedString (Ljava/lang/StringBuilder;)V + public fun toString ()Ljava/lang/String; + protected final fun unexpectedToken (C)V +} + +public final class kotlinx/serialization/json/internal/JsonLexerKt { + public static final field BATCH_SIZE I +} + public final class kotlinx/serialization/json/internal/JsonStreamsKt { public static final fun decodeByReader (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/internal/SerialReader;)Ljava/lang/Object; public static final fun decodeToSequence (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/json/internal/SerialReader;Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/DecodeSequenceMode;)Lkotlin/sequences/Sequence; @@ -374,8 +400,55 @@ public abstract interface class kotlinx/serialization/json/internal/SerialReader public abstract fun read ([CII)I } +public class kotlinx/serialization/json/internal/StreamingJsonDecoder : kotlinx/serialization/encoding/AbstractDecoder, kotlinx/serialization/json/JsonDecoder { + public fun (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/json/internal/WriteMode;Lkotlinx/serialization/json/internal/AbstractJsonLexer;Lkotlinx/serialization/descriptors/SerialDescriptor;)V + public fun beginStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeDecoder; + public fun decodeBoolean ()Z + public fun decodeByte ()B + public fun decodeChar ()C + public fun decodeDouble ()D + public fun decodeElementIndex (Lkotlinx/serialization/descriptors/SerialDescriptor;)I + public fun decodeEnum (Lkotlinx/serialization/descriptors/SerialDescriptor;)I + public fun decodeFloat ()F + public fun decodeInline (Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/Decoder; + public fun decodeInt ()I + public fun decodeJsonElement ()Lkotlinx/serialization/json/JsonElement; + public fun decodeLong ()J + public fun decodeNotNullMark ()Z + public fun decodeNull ()Ljava/lang/Void; + public fun decodeSerializableElement (Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object; + public fun decodeSerializableValue (Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object; + public fun decodeShort ()S + public fun decodeString ()Ljava/lang/String; + public fun endStructure (Lkotlinx/serialization/descriptors/SerialDescriptor;)V + public final fun getJson ()Lkotlinx/serialization/json/Json; + public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule; +} + +public final class kotlinx/serialization/json/internal/StringJsonLexer : kotlinx/serialization/json/internal/AbstractJsonLexer { + public fun (Ljava/lang/String;)V + public synthetic fun getSource ()Ljava/lang/CharSequence; +} + public final class kotlinx/serialization/json/internal/StringOpsKt { public static final fun getESCAPE_MARKERS ()[B public static final fun getESCAPE_STRINGS ()[Ljava/lang/String; } +public final class kotlinx/serialization/json/internal/TreeJsonDecoderKt { + public static final fun readJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/json/JsonElement;Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object; +} + +public final class kotlinx/serialization/json/internal/TreeJsonEncoderKt { + public static final fun writeJson (Lkotlinx/serialization/json/Json;Ljava/lang/Object;Lkotlinx/serialization/SerializationStrategy;)Lkotlinx/serialization/json/JsonElement; +} + +public final class kotlinx/serialization/json/internal/WriteMode : java/lang/Enum { + public static final field LIST Lkotlinx/serialization/json/internal/WriteMode; + public static final field MAP Lkotlinx/serialization/json/internal/WriteMode; + public static final field OBJ Lkotlinx/serialization/json/internal/WriteMode; + public static final field POLY_OBJ Lkotlinx/serialization/json/internal/WriteMode; + public static fun valueOf (Ljava/lang/String;)Lkotlinx/serialization/json/internal/WriteMode; + public static fun values ()[Lkotlinx/serialization/json/internal/WriteMode; +} + diff --git a/formats/json/build.gradle b/formats/json/build.gradle index 229444598..ec066ee94 100644 --- a/formats/json/build.gradle +++ b/formats/json/build.gradle @@ -15,18 +15,7 @@ kotlin { api project(":kotlinx-serialization-core") } } - - jvmTest { - dependencies { - implementation 'com.google.code.gson:gson:2.8.5' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - } - } } } -compileTestKotlinJsLegacy { - exclude '**/PropertyInitializerTest.kt' -} - Java9Modularity.configureJava9ModuleInfo(project) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt index 7d2133040..5c50f2a14 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt @@ -70,7 +70,8 @@ public fun JsonPrimitive(value: String?): JsonPrimitive { } // JsonLiteral is deprecated for public use and no longer available. Please use JsonPrimitive instead -internal class JsonLiteral internal constructor( +@InternalSerializationApi +public class JsonLiteral internal constructor( body: Any, public override val isString: Boolean ) : JsonPrimitive() { diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt index bf2290440..33aae63a7 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt @@ -17,7 +17,8 @@ import kotlin.jvm.* * [JsonDecoder] which reads given JSON from [AbstractJsonLexer] field by field. */ @OptIn(ExperimentalSerializationApi::class, ExperimentalUnsignedTypes::class) -internal open class StreamingJsonDecoder( +@InternalSerializationApi +public open class StreamingJsonDecoder( final override val json: Json, private val mode: WriteMode, @JvmField internal val lexer: AbstractJsonLexer, diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt index 55e23a13b..957491748 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt @@ -15,7 +15,8 @@ import kotlinx.serialization.json.* import kotlinx.serialization.modules.* import kotlin.jvm.* -internal fun Json.readJson(element: JsonElement, deserializer: DeserializationStrategy): T { +@InternalSerializationApi +public fun Json.readJson(element: JsonElement, deserializer: DeserializationStrategy): T { val input = when (element) { is JsonObject -> JsonTreeDecoder(this, element) is JsonArray -> JsonTreeListDecoder(this, element) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt index 74f02bf46..766b48f2a 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt @@ -14,7 +14,8 @@ import kotlinx.serialization.modules.* import kotlin.collections.set import kotlin.jvm.* -internal fun Json.writeJson(value: T, serializer: SerializationStrategy): JsonElement { +@InternalSerializationApi +public fun Json.writeJson(value: T, serializer: SerializationStrategy): JsonElement { lateinit var result: JsonElement val encoder = JsonTreeEncoder(this) { result = it } encoder.encodeSerializableValue(serializer, value) diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt index 382d8bce4..1341499cd 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt @@ -11,7 +11,8 @@ import kotlinx.serialization.json.* import kotlinx.serialization.modules.* import kotlin.jvm.* -internal enum class WriteMode(@JvmField val begin: Char, @JvmField val end: Char) { +@InternalSerializationApi +public enum class WriteMode(@JvmField internal val begin: Char, @JvmField internal val end: Char) { OBJ(BEGIN_OBJ, END_OBJ), LIST(BEGIN_LIST, END_LIST), MAP(BEGIN_OBJ, END_OBJ), diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/AbstractJsonLexer.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/AbstractJsonLexer.kt index 5e1eee7c3..52def51ce 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/AbstractJsonLexer.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/AbstractJsonLexer.kt @@ -4,7 +4,7 @@ package kotlinx.serialization.json.internal -import kotlinx.serialization.json.internal.* +import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.json.internal.CharMappings.CHAR_TO_TOKEN import kotlinx.serialization.json.internal.CharMappings.ESCAPE_2_CHAR import kotlin.js.* @@ -130,7 +130,8 @@ internal fun escapeToChar(c: Int): Char = if (c < ESC2C_MAX) ESCAPE_2_CHAR[c] el * of them for the performance reasons (devirtualization of [CharSequence] and avoid * of additional spills). */ -internal abstract class AbstractJsonLexer { +@InternalSerializationApi +public abstract class AbstractJsonLexer { protected abstract val source: CharSequence @@ -138,20 +139,20 @@ internal abstract class AbstractJsonLexer { protected var currentPosition: Int = 0 // position in source @JvmField - val path = JsonPath() + internal val path = JsonPath() - open fun ensureHaveChars() {} + internal open fun ensureHaveChars() {} - fun isNotEof(): Boolean = peekNextToken() != TC_EOF + internal fun isNotEof(): Boolean = peekNextToken() != TC_EOF // Used as bound check in loops - abstract fun prefetchOrEof(position: Int): Int + internal abstract fun prefetchOrEof(position: Int): Int - abstract fun tryConsumeComma(): Boolean + internal abstract fun tryConsumeComma(): Boolean - abstract fun canConsumeValue(): Boolean + internal abstract fun canConsumeValue(): Boolean - abstract fun consumeNextToken(): Byte + internal abstract fun consumeNextToken(): Byte protected fun isValidValueStart(c: Char): Boolean { return when (c) { @@ -160,7 +161,7 @@ internal abstract class AbstractJsonLexer { } } - fun expectEof() { + public fun expectEof() { val nextToken = consumeNextToken() if (nextToken != TC_EOF) fail("Expected EOF after parsing, but had ${source[currentPosition - 1]} instead") @@ -171,10 +172,10 @@ internal abstract class AbstractJsonLexer { * If the value was picked, 'consumeString' will take it without scanning the source. */ private var peekedString: String? = null - protected var escapedString = StringBuilder() + protected var escapedString: StringBuilder = StringBuilder() // TODO consider replacing usages of this method in JsonParser with char overload - fun consumeNextToken(expected: Byte): Byte { + internal fun consumeNextToken(expected: Byte): Byte { val token = consumeNextToken() if (token != expected) { fail(expected) @@ -182,7 +183,7 @@ internal abstract class AbstractJsonLexer { return token } - open fun consumeNextToken(expected: Char) { + internal open fun consumeNextToken(expected: Char) { ensureHaveChars() val source = source var cpos = currentPosition @@ -224,7 +225,7 @@ internal abstract class AbstractJsonLexer { fail("Expected $expected, but had '$s' instead", currentPosition - 1) } - fun peekNextToken(): Byte { + internal fun peekNextToken(): Byte { val source = source var cpos = currentPosition while (true) { @@ -247,7 +248,7 @@ internal abstract class AbstractJsonLexer { * Returns `true` if the next 4 chars in input are not `null`, * `false` otherwise and consumes it. */ - fun tryConsumeNotNull(): Boolean { + internal fun tryConsumeNotNull(): Boolean { var current = skipWhitespaces() current = prefetchOrEof(current) // Cannot consume null due to EOF, maybe something else @@ -265,7 +266,7 @@ internal abstract class AbstractJsonLexer { return false } - open fun skipWhitespaces(): Int { + internal open fun skipWhitespaces(): Int { var current = currentPosition // Skip whitespaces while (true) { @@ -283,7 +284,7 @@ internal abstract class AbstractJsonLexer { return current } - fun peekString(isLenient: Boolean): String? { + internal fun peekString(isLenient: Boolean): String? { val token = peekNextToken() val string = if (isLenient) { if (token != TC_STRING && token != TC_OTHER) return null @@ -296,16 +297,16 @@ internal abstract class AbstractJsonLexer { return string } - open fun indexOf(char: Char, startPos: Int) = source.indexOf(char, startPos) - open fun substring(startPos: Int, endPos: Int) = source.substring(startPos, endPos) + internal open fun indexOf(char: Char, startPos: Int) = source.indexOf(char, startPos) + internal open fun substring(startPos: Int, endPos: Int) = source.substring(startPos, endPos) /* * This method is a copy of consumeString, but used for key of json objects, so there * is no need to lookup peeked string. */ - abstract fun consumeKeyString(): String + internal abstract fun consumeKeyString(): String - fun consumeString(): String { + internal fun consumeString(): String { if (peekedString != null) { return takePeeked() } @@ -365,7 +366,7 @@ internal abstract class AbstractJsonLexer { return peekedString!!.also { peekedString = null } } - fun consumeStringLenientNotNull(): String { + internal fun consumeStringLenientNotNull(): String { val result = consumeStringLenient() /* * Check if lenient value is 'null' _without_ quotation marks and fail for non-nullable read if so. @@ -382,7 +383,7 @@ internal abstract class AbstractJsonLexer { } // Allows consuming unquoted string - fun consumeStringLenient(): String { + internal fun consumeStringLenient(): String { if (peekedString != null) { return takePeeked() } @@ -471,7 +472,7 @@ internal abstract class AbstractJsonLexer { } } - fun skipElement(allowLenientStrings: Boolean) { + internal fun skipElement(allowLenientStrings: Boolean) { val tokenStack = mutableListOf() var lastToken = peekNextToken() if (lastToken != TC_BEGIN_LIST && lastToken != TC_BEGIN_OBJ) { @@ -515,7 +516,7 @@ internal abstract class AbstractJsonLexer { return "JsonReader(source='$source', currentPosition=$currentPosition)" } - fun failOnUnknownKey(key: String) { + internal fun failOnUnknownKey(key: String) { // At this moment we already have both key and semicolon (and whitespaces! consumed), // but still would like an error to point to the beginning of the key, so we are backtracking it val processed = substring(0, currentPosition) @@ -523,12 +524,12 @@ internal abstract class AbstractJsonLexer { fail("Encountered an unknown key '$key'", lastIndexOf, ignoreUnknownKeysHint) } - fun fail(message: String, position: Int = currentPosition, hint: String = ""): Nothing { + internal fun fail(message: String, position: Int = currentPosition, hint: String = ""): Nothing { val hintMessage = if (hint.isEmpty()) "" else "\n$hint" throw JsonDecodingException(position, message + " at path: " + path.getPath() + hintMessage, source) } - fun consumeNumericLiteral(): Long { + internal fun consumeNumericLiteral(): Long { /* * This is an optimized (~40% for numbers) version of consumeString().toLong() * that doesn't allocate and also doesn't support any radix but 10 @@ -582,11 +583,11 @@ internal abstract class AbstractJsonLexer { } - fun consumeBoolean(): Boolean { + internal fun consumeBoolean(): Boolean { return consumeBoolean(skipWhitespaces()) } - fun consumeBooleanLenient(): Boolean { + internal fun consumeBooleanLenient(): Boolean { var current = skipWhitespaces() if (current == source.length) fail("EOF") val hasQuotation = if (source[current] == STRING) { diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexerJvm.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexer.kt similarity index 94% rename from formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexerJvm.kt rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexer.kt index 9a3179110..af765321f 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexerJvm.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/JsonLexer.kt @@ -4,14 +4,11 @@ package kotlinx.serialization.json.internal -internal const val BATCH_SIZE = 16 * 1024 -private const val DEFAULT_THRESHOLD = 128 - - -// This size of buffered reader is very important here, because utf-8 decoding is slow. -// Jackson and Moshi are faster because they have specialized UTF-8 parser directly over InputStream -internal const val READER_BUF_SIZE = 16 * BATCH_SIZE +import kotlinx.serialization.InternalSerializationApi +@InternalSerializationApi +public const val BATCH_SIZE: Int = 16 * 1024 +private const val DEFAULT_THRESHOLD = 128 /** * For some reason this hand-rolled implementation is faster than @@ -167,6 +164,6 @@ internal class ReaderJsonLexer( } override fun appendRange(fromIndex: Int, toIndex: Int) { - escapedString.append(_source, fromIndex, toIndex - fromIndex) + escapedString.appendRange(_source, fromIndex, toIndex) } } diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/StringJsonLexer.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/StringJsonLexer.kt index 0ff980a2c..8cf4881d2 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/StringJsonLexer.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/lexer/StringJsonLexer.kt @@ -4,7 +4,10 @@ package kotlinx.serialization.json.internal -internal class StringJsonLexer(override val source: String) : AbstractJsonLexer() { +import kotlinx.serialization.InternalSerializationApi + +@InternalSerializationApi +public class StringJsonLexer(override val source: String) : AbstractJsonLexer() { override fun prefetchOrEof(position: Int): Int = if (position < source.length) position else -1 diff --git a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt deleted file mode 100644 index 7a45c8dd6..000000000 --- a/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.serialization.json.serializers - -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.* -import kotlinx.serialization.json.internal.* -import kotlinx.serialization.test.* -import kotlin.test.* - -class JsonObjectSerializerTest : JsonTestBase() { - - private val expected = """{"element":{"literal":1,"nullKey":null,"nested":{"another literal":"some value"},"\\. escaped":"\\. escaped","\n new line":"\n new line"}}""" - private val expectedTopLevel = """{"literal":1,"nullKey":null,"nested":{"another literal":"some value"},"\\. escaped":"\\. escaped","\n new line":"\n new line"}""" - - @Test - fun testJsonObject() = parametrizedTest(default) { - assertStringFormAndRestored(expected, JsonObjectWrapper(prebuiltJson()), JsonObjectWrapper.serializer()) - } - - @Test - fun testJsonObjectAsElement() = parametrizedTest(default) { - assertStringFormAndRestored(expected, JsonElementWrapper(prebuiltJson()), JsonElementWrapper.serializer()) - } - - @Test - fun testTopLevelJsonObject() = parametrizedTest (default) { - assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonObjectSerializer) - } - - @Test - fun testTopLevelJsonObjectAsElement() = parametrizedTest (default) { - assertStringFormAndRestored(expectedTopLevel, prebuiltJson(), JsonElementSerializer) - } - - @Test - fun testJsonObjectToString() { - val prebuiltJson = prebuiltJson() - val string = lenient.encodeToString(JsonElementSerializer, prebuiltJson) - assertEquals(string, prebuiltJson.toString()) - } - - @Test - fun testDocumentationSample() { - val string = Json.encodeToString(JsonElementSerializer, buildJsonObject { put("key", 1.0) }) - val literal = Json.decodeFromString(JsonElementSerializer, string) - assertEquals(JsonObject(mapOf("key" to JsonPrimitive(1.0))), literal) - } - - @Test - fun testMissingCommas() = parametrizedTest { jsonTestingMode -> - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{ \"1\": \"2\" \"3\":\"4\"}", jsonTestingMode) } - } - - @Test - fun testEmptyObject() = parametrizedTest { jsonTestingMode -> - assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObjectSerializer, "{}", jsonTestingMode)) - assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObjectSerializer, "{}", jsonTestingMode)) - assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObjectSerializer, "{\n\n}", jsonTestingMode)) - assertEquals(JsonObject(emptyMap()), lenient.decodeFromString(JsonObjectSerializer, "{ \t}", jsonTestingMode)) - } - - @Test - fun testInvalidObject() = parametrizedTest { jsonTestingMode -> - assertFailsWith { default.decodeFromString(JsonObjectSerializer, "{\"a\":\"b\"]", jsonTestingMode) } - assertFailsWith { default.decodeFromString(JsonObjectSerializer, "{", jsonTestingMode) } - if (jsonTestingMode != JsonTestingMode.JAVA_STREAMS) // Streams support dangling characters - assertFailsWith { default.decodeFromString(JsonObjectSerializer, "{}}", jsonTestingMode) } - assertFailsWith { default.decodeFromString(JsonObjectSerializer, "{]", jsonTestingMode) } - } - - @Test - fun testWhitespaces() = parametrizedTest { jsonTestingMode -> - assertEquals( - JsonObject(mapOf("1" to JsonPrimitive(2), "3" to JsonPrimitive(4), "5" to JsonPrimitive(6))), - lenient.decodeFromString(JsonObjectSerializer, "{1: 2, 3: \n 4, 5:6}", jsonTestingMode) - ) - } - - @Test - fun testExcessiveCommas() = parametrizedTest { jsonTestingMode -> - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{\"a\":\"b\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{\"a\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,\"1\":\"2\"}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,\"1\":\"2\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,,\"1\":\"2\"}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{\"1\":\"2\",,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{\"1\":\"2\",,\"2\":\"2\"}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{, ,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(JsonObjectSerializer, "{,\n,}", jsonTestingMode) } - } - - @Serializable - data class Holder(val a: String) - - @Test - fun testExcessiveCommasInObject() = parametrizedTest { jsonTestingMode -> - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{\"a\":\"b\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{\"a\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,\"a\":\"b\"}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,\"a\":\"b\",}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,,\"a\":\"b\"}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{\"a\":\"b\",,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{, ,}", jsonTestingMode) } - assertFailsWith { lenient.decodeFromString(Holder.serializer(), "{,\n,}", jsonTestingMode) } - } - - private fun prebuiltJson(): JsonObject { - return buildJsonObject { - put("literal", 1) - put("nullKey", JsonNull) - putJsonObject("nested") { - put("another literal", "some value") - } - put("\\. escaped", "\\. escaped") - put("\n new line", "\n new line") - } - } -} diff --git a/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt b/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt index a6658c7cb..1bc825a50 100644 --- a/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt +++ b/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt @@ -15,7 +15,8 @@ import kotlin.math.* /** * [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER] */ -internal const val MAX_SAFE_INTEGER: Double = 9007199254740991.toDouble() // 2^53 - 1 +@InternalSerializationApi +public const val MAX_SAFE_INTEGER: Double = 9007199254740991.toDouble() // 2^53 - 1 @JsName("decodeDynamic") internal fun Json.decodeDynamic(deserializer: DeserializationStrategy, dynamic: dynamic): T { diff --git a/formats/json/jvmMain/src/kotlinx/serialization/json/internal/JvmJsonStreams.kt b/formats/json/jvmMain/src/kotlinx/serialization/json/internal/JvmJsonStreams.kt index b10c86ee8..4bf0c4f32 100644 --- a/formats/json/jvmMain/src/kotlinx/serialization/json/internal/JvmJsonStreams.kt +++ b/formats/json/jvmMain/src/kotlinx/serialization/json/internal/JvmJsonStreams.kt @@ -98,28 +98,6 @@ internal class JsonToJavaStreamWriter(private val stream: OutputStream) : JsonWr return oldSize } -// override fun writeQuoted(text: String) { -// val escapeStrings = ESCAPE_STRINGS -// val length = text.length -// -// writeUtf8CodePoint(DOUBLE_QUOTES_CODE) -// var lastPos = 0 -// for (i in 0 until length) { -// val c = text[i].code -// if (c < escapeStrings.size) { -// escapeStrings[c]?.let { -// writeUtf8(text, lastPos, i) // flush prev -// writeUtf8(it) -// lastPos = i + 1 -// } -// } -// } -// -// if (lastPos != 0) writeUtf8(text, lastPos, length) -// else writeUtf8(text) -// writeUtf8CodePoint(DOUBLE_QUOTES_CODE) -// } - override fun release() { flush() CharArrayPool.release(array) diff --git a/settings.gradle b/settings.gradle index f6472f1a1..01d4ea62f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,6 +16,9 @@ project(':kotlinx-serialization-json').projectDir = file('./formats/json') include ':kotlinx-serialization-json-okio' project(':kotlinx-serialization-json-okio').projectDir = file('./formats/json-okio') +include ':kotlinx-serialization-json-tests' +project(':kotlinx-serialization-json-tests').projectDir = file('./formats/json-tests') + include ':kotlinx-serialization-protobuf' project(':kotlinx-serialization-protobuf').projectDir = file('./formats/protobuf')