From ccca50f084e48ba23664676d77e686f4d461dadb Mon Sep 17 00:00:00 2001 From: Ben Woodworth Date: Thu, 23 May 2024 16:22:20 -0400 Subject: [PATCH] Use Parameterize instead of Kotest property testing (move files) Reorganize the test files after the Parameterize refactor, as a separate commit so their history is preserved. - Parameter files -> /test/parameters/*Parameters.kt - /test/data/*Nbt.kt -> /test/file/*Nbt.kt --- src/commonTest/kotlin/NbtTagTest.kt | 2 +- src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt | 8 ++++---- src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt | 2 +- src/commonTest/kotlin/internal/NbtTagTypeTest.kt | 2 +- src/commonTest/kotlin/internal/SerialDescriptorTest.kt | 2 +- .../kotlin/internal/StringifiedNbtWriterTest.kt | 4 ++-- src/commonTest/kotlin/internal/StringsTest.kt | 2 +- src/commonTest/kotlin/internal/TreeNbtReaderTest.kt | 7 +++++-- src/commonTest/kotlin/internal/TreeNbtWriterTest.kt | 8 +++++--- .../kotlin/serialization/ClassSerializationTest.kt | 2 +- .../kotlin/serialization/PrimitiveSerializationTest.kt | 3 +-- .../kotlin/test/{data => file}/BigTestExtendedNbt.kt | 2 +- src/commonTest/kotlin/test/{data => file}/BigTestNbt.kt | 2 +- src/commonTest/kotlin/test/file/NbtTestFiles.kt | 1 - src/commonTest/kotlin/test/{data => file}/TestNbt.kt | 2 +- .../nbtList.kt => parameters/NbtListParameters.kt} | 2 +- .../nbtNumbers.kt => parameters/NbtNumberParameters.kt} | 2 +- .../nbtString.kt => parameters/NbtStringParameters.kt} | 2 +- .../nbtTag.kt => parameters/NbtTagParameters.kt} | 2 +- .../NbtVariantParameters.kt} | 2 +- .../{TestValues.kt => parameters/StdlibParameters.kt} | 2 +- 21 files changed, 32 insertions(+), 29 deletions(-) rename src/commonTest/kotlin/test/{data => file}/BigTestExtendedNbt.kt (99%) rename src/commonTest/kotlin/test/{data => file}/BigTestNbt.kt (99%) rename src/commonTest/kotlin/test/{data => file}/TestNbt.kt (94%) rename src/commonTest/kotlin/test/{generators/nbtList.kt => parameters/NbtListParameters.kt} (96%) rename src/commonTest/kotlin/test/{generators/nbtNumbers.kt => parameters/NbtNumberParameters.kt} (97%) rename src/commonTest/kotlin/test/{generators/nbtString.kt => parameters/NbtStringParameters.kt} (95%) rename src/commonTest/kotlin/test/{generators/nbtTag.kt => parameters/NbtTagParameters.kt} (95%) rename src/commonTest/kotlin/test/{data/nbtVariantEdgeCases.kt => parameters/NbtVariantParameters.kt} (96%) rename src/commonTest/kotlin/test/{TestValues.kt => parameters/StdlibParameters.kt} (98%) diff --git a/src/commonTest/kotlin/NbtTagTest.kt b/src/commonTest/kotlin/NbtTagTest.kt index 101eb045..ca84fd72 100644 --- a/src/commonTest/kotlin/NbtTagTest.kt +++ b/src/commonTest/kotlin/NbtTagTest.kt @@ -4,8 +4,8 @@ import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter import com.benwoodworth.parameterize.parameterOf import net.benwoodworth.knbt.test.filter -import net.benwoodworth.knbt.test.generators.* import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.* import kotlin.reflect.KProperty1 import kotlin.test.* diff --git a/src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt b/src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt index 78085930..ceb9ae68 100644 --- a/src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt +++ b/src/commonTest/kotlin/NbtVariantJavaNetworkTest.kt @@ -7,12 +7,12 @@ import kotlinx.serialization.decodeFromByteArray import kotlinx.serialization.encodeToByteArray import net.benwoodworth.knbt.okio.decodeFromBufferedSource import net.benwoodworth.knbt.test.asSource -import net.benwoodworth.knbt.test.data.isEmptyNamedVersion -import net.benwoodworth.knbt.test.data.isUnnamedVersion -import net.benwoodworth.knbt.test.data.parameterOfNbtVariantEdgeCases import net.benwoodworth.knbt.test.filter -import net.benwoodworth.knbt.test.generators.parameterOfNbtTagTypeEdgeCases import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.isEmptyNamedVersion +import net.benwoodworth.knbt.test.parameters.isUnnamedVersion +import net.benwoodworth.knbt.test.parameters.parameterOfNbtTagTypeEdgeCases +import net.benwoodworth.knbt.test.parameters.parameterOfNbtVariantEdgeCases import okio.buffer import kotlin.test.* diff --git a/src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt b/src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt index d0246c99..ec859012 100644 --- a/src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt +++ b/src/commonTest/kotlin/internal/BinaryNbtWriterTest.kt @@ -11,8 +11,8 @@ import net.benwoodworth.knbt.test.TestSink import net.benwoodworth.knbt.test.asSource import net.benwoodworth.knbt.test.file.nbtFiles import net.benwoodworth.knbt.test.filter -import net.benwoodworth.knbt.test.generators.parameterOfNbtTagTypeEdgeCases import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.parameterOfNbtTagTypeEdgeCases import okio.blackholeSink import okio.buffer import okio.use diff --git a/src/commonTest/kotlin/internal/NbtTagTypeTest.kt b/src/commonTest/kotlin/internal/NbtTagTypeTest.kt index 6f8d4e27..5fc8142a 100644 --- a/src/commonTest/kotlin/internal/NbtTagTypeTest.kt +++ b/src/commonTest/kotlin/internal/NbtTagTypeTest.kt @@ -3,8 +3,8 @@ package net.benwoodworth.knbt.internal import com.benwoodworth.parameterize.parameter import net.benwoodworth.knbt.* import net.benwoodworth.knbt.test.filter -import net.benwoodworth.knbt.test.parameterOfBytes import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.parameterOfBytes import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull diff --git a/src/commonTest/kotlin/internal/SerialDescriptorTest.kt b/src/commonTest/kotlin/internal/SerialDescriptorTest.kt index 4210639e..478316a2 100644 --- a/src/commonTest/kotlin/internal/SerialDescriptorTest.kt +++ b/src/commonTest/kotlin/internal/SerialDescriptorTest.kt @@ -13,8 +13,8 @@ import kotlinx.serialization.descriptors.buildClassSerialDescriptor import kotlinx.serialization.descriptors.buildSerialDescriptor import kotlinx.serialization.serializer import net.benwoodworth.knbt.NbtArray -import net.benwoodworth.knbt.test.parameterOfBooleans import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.parameterOfBooleans import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/src/commonTest/kotlin/internal/StringifiedNbtWriterTest.kt b/src/commonTest/kotlin/internal/StringifiedNbtWriterTest.kt index b7a466c2..7af7198a 100644 --- a/src/commonTest/kotlin/internal/StringifiedNbtWriterTest.kt +++ b/src/commonTest/kotlin/internal/StringifiedNbtWriterTest.kt @@ -3,8 +3,8 @@ package net.benwoodworth.knbt.internal import kotlinx.serialization.encodeToString import net.benwoodworth.knbt.ExperimentalNbtApi import net.benwoodworth.knbt.StringifiedNbt -import net.benwoodworth.knbt.test.data.bigTestExtendedTag -import net.benwoodworth.knbt.test.data.testTag +import net.benwoodworth.knbt.test.file.bigTestExtendedTag +import net.benwoodworth.knbt.test.file.testTag import net.benwoodworth.knbt.test.fix import kotlin.test.Test import kotlin.test.assertEquals diff --git a/src/commonTest/kotlin/internal/StringsTest.kt b/src/commonTest/kotlin/internal/StringsTest.kt index 34a6c248..3f3b1225 100644 --- a/src/commonTest/kotlin/internal/StringsTest.kt +++ b/src/commonTest/kotlin/internal/StringsTest.kt @@ -1,7 +1,7 @@ package net.benwoodworth.knbt.internal -import net.benwoodworth.knbt.test.parameterOfBytes import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.parameterOfBytes import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue diff --git a/src/commonTest/kotlin/internal/TreeNbtReaderTest.kt b/src/commonTest/kotlin/internal/TreeNbtReaderTest.kt index 4557d238..bf73eb04 100644 --- a/src/commonTest/kotlin/internal/TreeNbtReaderTest.kt +++ b/src/commonTest/kotlin/internal/TreeNbtReaderTest.kt @@ -3,8 +3,11 @@ package net.benwoodworth.knbt.internal import net.benwoodworth.knbt.* import net.benwoodworth.knbt.internal.NbtReader.* import net.benwoodworth.knbt.internal.NbtTagType.* -import net.benwoodworth.knbt.test.* -import net.benwoodworth.knbt.test.data.* +import net.benwoodworth.knbt.test.NbtFormat +import net.benwoodworth.knbt.test.file.* +import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.* +import net.benwoodworth.knbt.test.shouldReturn import kotlin.test.Test class TreeNbtReaderTest { diff --git a/src/commonTest/kotlin/internal/TreeNbtWriterTest.kt b/src/commonTest/kotlin/internal/TreeNbtWriterTest.kt index 9e93458e..d3a07113 100644 --- a/src/commonTest/kotlin/internal/TreeNbtWriterTest.kt +++ b/src/commonTest/kotlin/internal/TreeNbtWriterTest.kt @@ -2,9 +2,11 @@ package net.benwoodworth.knbt.internal import net.benwoodworth.knbt.* import net.benwoodworth.knbt.internal.NbtTagType.* -import net.benwoodworth.knbt.test.* -import net.benwoodworth.knbt.test.data.testClass -import net.benwoodworth.knbt.test.data.testTag +import net.benwoodworth.knbt.test.NbtFormat +import net.benwoodworth.knbt.test.file.testClass +import net.benwoodworth.knbt.test.file.testTag +import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.* import kotlin.test.Test import kotlin.test.assertEquals diff --git a/src/commonTest/kotlin/serialization/ClassSerializationTest.kt b/src/commonTest/kotlin/serialization/ClassSerializationTest.kt index 5f482d7c..8a32cc21 100644 --- a/src/commonTest/kotlin/serialization/ClassSerializationTest.kt +++ b/src/commonTest/kotlin/serialization/ClassSerializationTest.kt @@ -5,7 +5,7 @@ import net.benwoodworth.knbt.NbtNamed import net.benwoodworth.knbt.buildNbtCompound import net.benwoodworth.knbt.put import net.benwoodworth.knbt.putNbtCompound -import net.benwoodworth.knbt.test.data.* +import net.benwoodworth.knbt.test.file.* import kotlin.test.Test class ClassSerializationTest : SerializationTest() { diff --git a/src/commonTest/kotlin/serialization/PrimitiveSerializationTest.kt b/src/commonTest/kotlin/serialization/PrimitiveSerializationTest.kt index 53961bc2..4ec0eba2 100644 --- a/src/commonTest/kotlin/serialization/PrimitiveSerializationTest.kt +++ b/src/commonTest/kotlin/serialization/PrimitiveSerializationTest.kt @@ -5,9 +5,8 @@ import kotlinx.serialization.builtins.serializer import net.benwoodworth.knbt.NbtByte import net.benwoodworth.knbt.NbtString import net.benwoodworth.knbt.fromBoolean -import net.benwoodworth.knbt.test.generators.* -import net.benwoodworth.knbt.test.parameterOfBooleans import net.benwoodworth.knbt.test.parameterizeTest +import net.benwoodworth.knbt.test.parameters.* import net.benwoodworth.knbt.toBoolean import kotlin.test.Test diff --git a/src/commonTest/kotlin/test/data/BigTestExtendedNbt.kt b/src/commonTest/kotlin/test/file/BigTestExtendedNbt.kt similarity index 99% rename from src/commonTest/kotlin/test/data/BigTestExtendedNbt.kt rename to src/commonTest/kotlin/test/file/BigTestExtendedNbt.kt index 11e26337..5c34fd10 100644 --- a/src/commonTest/kotlin/test/data/BigTestExtendedNbt.kt +++ b/src/commonTest/kotlin/test/file/BigTestExtendedNbt.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.data +package net.benwoodworth.knbt.test.file import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/src/commonTest/kotlin/test/data/BigTestNbt.kt b/src/commonTest/kotlin/test/file/BigTestNbt.kt similarity index 99% rename from src/commonTest/kotlin/test/data/BigTestNbt.kt rename to src/commonTest/kotlin/test/file/BigTestNbt.kt index f16a1968..39ed7e7b 100644 --- a/src/commonTest/kotlin/test/data/BigTestNbt.kt +++ b/src/commonTest/kotlin/test/file/BigTestNbt.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.data +package net.benwoodworth.knbt.test.file import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/src/commonTest/kotlin/test/file/NbtTestFiles.kt b/src/commonTest/kotlin/test/file/NbtTestFiles.kt index 5faae4da..4ea55071 100644 --- a/src/commonTest/kotlin/test/file/NbtTestFiles.kt +++ b/src/commonTest/kotlin/test/file/NbtTestFiles.kt @@ -5,7 +5,6 @@ import net.benwoodworth.knbt.Nbt import net.benwoodworth.knbt.NbtCompression import net.benwoodworth.knbt.NbtVariant import net.benwoodworth.knbt.test.asSource -import net.benwoodworth.knbt.test.data.* import okio.Source class NbtTestFile( diff --git a/src/commonTest/kotlin/test/data/TestNbt.kt b/src/commonTest/kotlin/test/file/TestNbt.kt similarity index 94% rename from src/commonTest/kotlin/test/data/TestNbt.kt rename to src/commonTest/kotlin/test/file/TestNbt.kt index 1f3c5d66..2b49d8f9 100644 --- a/src/commonTest/kotlin/test/data/TestNbt.kt +++ b/src/commonTest/kotlin/test/file/TestNbt.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.data +package net.benwoodworth.knbt.test.file import kotlinx.serialization.Serializable import net.benwoodworth.knbt.NbtCompound diff --git a/src/commonTest/kotlin/test/generators/nbtList.kt b/src/commonTest/kotlin/test/parameters/NbtListParameters.kt similarity index 96% rename from src/commonTest/kotlin/test/generators/nbtList.kt rename to src/commonTest/kotlin/test/parameters/NbtListParameters.kt index fff7c600..0ac16e53 100644 --- a/src/commonTest/kotlin/test/generators/nbtList.kt +++ b/src/commonTest/kotlin/test/parameters/NbtListParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.generators +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter diff --git a/src/commonTest/kotlin/test/generators/nbtNumbers.kt b/src/commonTest/kotlin/test/parameters/NbtNumberParameters.kt similarity index 97% rename from src/commonTest/kotlin/test/generators/nbtNumbers.kt rename to src/commonTest/kotlin/test/parameters/NbtNumberParameters.kt index 10225781..660a0cc3 100644 --- a/src/commonTest/kotlin/test/generators/nbtNumbers.kt +++ b/src/commonTest/kotlin/test/parameters/NbtNumberParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.generators +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter diff --git a/src/commonTest/kotlin/test/generators/nbtString.kt b/src/commonTest/kotlin/test/parameters/NbtStringParameters.kt similarity index 95% rename from src/commonTest/kotlin/test/generators/nbtString.kt rename to src/commonTest/kotlin/test/parameters/NbtStringParameters.kt index 47393a79..14f9e3f2 100644 --- a/src/commonTest/kotlin/test/generators/nbtString.kt +++ b/src/commonTest/kotlin/test/parameters/NbtStringParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.generators +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter diff --git a/src/commonTest/kotlin/test/generators/nbtTag.kt b/src/commonTest/kotlin/test/parameters/NbtTagParameters.kt similarity index 95% rename from src/commonTest/kotlin/test/generators/nbtTag.kt rename to src/commonTest/kotlin/test/parameters/NbtTagParameters.kt index a6ac3567..480ab377 100644 --- a/src/commonTest/kotlin/test/generators/nbtTag.kt +++ b/src/commonTest/kotlin/test/parameters/NbtTagParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.generators +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter diff --git a/src/commonTest/kotlin/test/data/nbtVariantEdgeCases.kt b/src/commonTest/kotlin/test/parameters/NbtVariantParameters.kt similarity index 96% rename from src/commonTest/kotlin/test/data/nbtVariantEdgeCases.kt rename to src/commonTest/kotlin/test/parameters/NbtVariantParameters.kt index 833e48ea..476f865b 100644 --- a/src/commonTest/kotlin/test/data/nbtVariantEdgeCases.kt +++ b/src/commonTest/kotlin/test/parameters/NbtVariantParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test.data +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter diff --git a/src/commonTest/kotlin/test/TestValues.kt b/src/commonTest/kotlin/test/parameters/StdlibParameters.kt similarity index 98% rename from src/commonTest/kotlin/test/TestValues.kt rename to src/commonTest/kotlin/test/parameters/StdlibParameters.kt index fc46953a..51764120 100644 --- a/src/commonTest/kotlin/test/TestValues.kt +++ b/src/commonTest/kotlin/test/parameters/StdlibParameters.kt @@ -1,4 +1,4 @@ -package net.benwoodworth.knbt.test +package net.benwoodworth.knbt.test.parameters import com.benwoodworth.parameterize.ParameterizeScope import com.benwoodworth.parameterize.parameter