From 05f77636750b4ef0dbe68c9d763a1b1716e21027 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Wed, 18 Dec 2024 19:01:25 +0100 Subject: [PATCH] style: disable `ktlint_standard_class-signature` only on kotlin tests, as per @paul-dingemans' suggestion in pinterest/ktlint#2902 --- .editorconfig | 3 ++ .../alchemist/model/actions/TestRemoveNode.kt | 17 +++---- .../test/RegressionTestOnRealCases.kt | 49 +++++++++---------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/.editorconfig b/.editorconfig index 45a5439e8c..fdae22a45d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,7 @@ [*.{kt,kts}] indent_size=4 max_line_length = 120 +insert_final_newline = true + +[**/*{t,T}est/kotlin/**.kt] ktlint_standard_class-signature = disabled diff --git a/alchemist-full/src/jvmTest/kotlin/it/unibo/alchemist/model/actions/TestRemoveNode.kt b/alchemist-full/src/jvmTest/kotlin/it/unibo/alchemist/model/actions/TestRemoveNode.kt index cc387b8eb5..da8827441b 100644 --- a/alchemist-full/src/jvmTest/kotlin/it/unibo/alchemist/model/actions/TestRemoveNode.kt +++ b/alchemist-full/src/jvmTest/kotlin/it/unibo/alchemist/model/actions/TestRemoveNode.kt @@ -14,13 +14,12 @@ import it.unibo.alchemist.model.Position import it.unibo.alchemist.test.AlchemistTesting.loadAlchemist import it.unibo.alchemist.test.AlchemistTesting.runInCurrentThread -class TestRemoveNode> : - StringSpec({ - "Nodes can be removed in a continous 2D space" { - val simulation = loadAlchemist("remove.yml") - val simulationRun = simulation.runInCurrentThread() - require(simulationRun.error.isEmpty) { - throw simulationRun.error.get() - } +class TestRemoveNode> : StringSpec({ + "Nodes can be removed in a continous 2D space" { + val simulation = loadAlchemist("remove.yml") + val simulationRun = simulation.runInCurrentThread() + require(simulationRun.error.isEmpty) { + throw simulationRun.error.get() } - }) + } +}) diff --git a/alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/RegressionTestOnRealCases.kt b/alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/RegressionTestOnRealCases.kt index 5fe792f907..70ea2304a8 100644 --- a/alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/RegressionTestOnRealCases.kt +++ b/alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/RegressionTestOnRealCases.kt @@ -21,29 +21,26 @@ import it.unibo.alchemist.boundary.LoadAlchemist import it.unibo.alchemist.boundary.launchers.DefaultLauncher import org.kaikikm.threadresloader.ResourceLoader -class RegressionTestOnRealCases : - FreeSpec( - { - "convoluted variable loading should work" { - val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/convoluted_variables.yml")) - loader.getDefault() shouldNotBe null - loader.variables should haveSize(3) - loader.variables.keys shouldContain "algorithm" - loader.variables - .getValue("algorithm") - .stream() - .count() - .toInt() shouldBeExactly 4 * 7 + 1 - } - "the default loader should be configurable with two parameters" { - val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/launcherWithoutAutostart.yml")) - loader.getDefault() shouldNotBe null - loader.launcher should beOfType() - (loader.launcher as DefaultLauncher).autoStart shouldBe false - } - "it should be possible to run a parallel batch" { - val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/batch-boostrap.yml")) - loader.launch() - } - }, - ) +class RegressionTestOnRealCases : FreeSpec({ + "convoluted variable loading should work" { + val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/convoluted_variables.yml")) + loader.getDefault() shouldNotBe null + loader.variables should haveSize(3) + loader.variables.keys shouldContain "algorithm" + loader.variables + .getValue("algorithm") + .stream() + .count() + .toInt() shouldBeExactly 4 * 7 + 1 + } + "the default loader should be configurable with two parameters" { + val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/launcherWithoutAutostart.yml")) + loader.getDefault() shouldNotBe null + loader.launcher should beOfType() + (loader.launcher as DefaultLauncher).autoStart shouldBe false + } + "it should be possible to run a parallel batch" { + val loader = LoadAlchemist.from(ResourceLoader.getResource("synthetic/batch-boostrap.yml")) + loader.launch() + } +})