diff options
author | Norbert Preining <norbert@preining.info> | 2020-03-05 03:00:59 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-03-05 03:00:59 +0000 |
commit | 898048513951b471a492afa23e46112d14bcb236 (patch) | |
tree | 8596afc705f55d2d07b324a756f7283ac0e2d21b /support/arara/source/src/test/kotlin/org/islandoftex/arara/model | |
parent | 19d25b8009801aa98ea2f46b45c37c257f990491 (diff) |
CTAN sync 202003050300
Diffstat (limited to 'support/arara/source/src/test/kotlin/org/islandoftex/arara/model')
-rw-r--r-- | support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt b/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt new file mode 100644 index 0000000000..7580d8c81e --- /dev/null +++ b/support/arara/source/src/test/kotlin/org/islandoftex/arara/model/SessionTest.kt @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: BSD-3-Clause +package org.islandoftex.arara.model + +import io.kotlintest.shouldBe +import io.kotlintest.shouldNotThrow +import io.kotlintest.shouldThrow +import io.kotlintest.specs.ShouldSpec + +class SessionTest : ShouldSpec({ + should("include all environment variables") { + Session.clear() + Session.updateEnvironmentVariables() + Session.contains("environment:PATH") shouldBe true + } + + should("properly check existence") { + Session.clear() + Session.put("A", "B") + Session.contains("A") shouldBe true + Session.contains("C") shouldBe false + } + + should("support insertion") { + Session.clear() + Session.put("A", "B") + Session.contains("A") shouldBe true + } + + should("support get") { + Session.clear() + Session.put("A", "B") + Session["A"] shouldBe "B" + } + + should("support removal") { + Session.clear() + Session.put("A", "B") + Session.put("C", "D") + Session.contains("A") shouldBe true + Session.contains("C") shouldBe true + Session.remove("A") + Session.contains("A") shouldBe false + Session.contains("C") shouldBe true + } + + should("clear itself") { + Session.clear() + Session.put("A", "B") + Session.put("C", "D") + Session.contains("A") shouldBe true + Session.contains("C") shouldBe true + Session.clear() + Session.contains("A") shouldBe false + Session.contains("C") shouldBe false + } + + should("throw on unknown removal") { + Session.clear() + Session.put("A", "B") + shouldNotThrow<AraraException> { + Session.remove("A") + } + shouldThrow<AraraException> { + Session.remove("C") + } + } + + should("throw on unknown getter") { + Session.clear() + Session.put("A", "B") + Session["A"] shouldBe "B" + shouldThrow<AraraException> { + Session["C"] + } + } +}) |