blob: 1ebd878cb2aad46b77ca13eec95b1222975aa8c5 (
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
|
(in-package :consfigurator/tests)
(named-readtables:in-readtable :consfigurator)
(in-consfig "consfigurator/tests")
(deftest contains-conf-space
(with-temporary-file (:pathname temp)
(with-open-file (s temp :if-exists :supersede :direction :output)
(write-sequence #>EOF>foo bar
# one two
one three
# one three
EOF s))
(deploy-these :local "localhost"
(evals `(file:contains-conf-space ,temp "foo" "baz" "one" "four" "two" "five")))
(read-file-string temp))
#>EOF>foo baz
one four
# one three
# one three
two five
EOF)
(deftest contains-conf-shell
(with-temporary-file (:pathname temp)
(with-open-file (s temp :if-exists :supersede :direction :output)
(write-sequence #>EOF>foo="bar baz"
# bar=baz
other="three word s"
EOF s))
(deploy-these :local "localhost"
(evals `(file:contains-conf-shell
,temp "bar" "two words" "quux" "one" "other" "one")))
(read-file-string temp))
#>EOF>foo="bar baz"
bar="two words"
other=one
quux=one
EOF)
(deftest contains-ini-settings
(with-temporary-file (:pathname temp)
(with-open-file (s temp :if-exists :supersede :direction :output)
(write-sequence #>EOF>[one]
two=three
[other]
; bar = ba
bar = baz baz quux
EOF s))
(deploy-these :local "localhost"
(evals `(file:contains-ini-settings ,temp
'("one" "four" "five")
'("another" "k" "v")
'("other" "bar" "baz")
'("another" "key" "val")
'("finally" "this" "one"))))
(read-file-string temp))
#>EOF>[one]
two=three
four=five
[other]
bar=baz
# bar=baz baz quux
[another]
k=v
key=val
[finally]
this=one
EOF)
|