blob: 7580d8c81e2d4efa57733f10ba743b75b8be6f53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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"]
}
}
})
|