Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_properties.aug
1 module Test_properties =
2     let conf = "
3 #
4 # Test tomcat properties file
5 #tomcat.commented.value=1
6     # config
7 tomcat.port = 8080
8 tomcat.application.name=testapp
9     tomcat.application.description=my test application
10 property.with_underscore=works
11 empty.property=
12 empty.property.withtrailingspaces=   \n! more comments
13 key: value
14 key2:value2
15 key3 :value3
16 key4:=value4
17 key5\"=value5
18 key6/c=value6
19
20 long.description=this is a description that happens to span \
21         more than one line with a combination of tabs and \
22         spaces \  \nor not
23
24 # comment break
25
26 short.break = a\
27  b
28
29 =empty_key
30  =empty_key
31
32 cheeses
33
34 spaces only
35 multi  spaces
36   indented spaces
37
38 \= =A
39 space and = equals
40 space with \
41    multiline
42
43 escaped\:colon=value
44 escaped\=equals=value
45 escaped\ space=value
46 "
47
48 (* Other tests that aren't supported yet
49 overflow.description=\
50   just wanted to indent it
51 *)
52
53 let lns = Properties.lns
54
55 test lns get conf =
56     { } { }
57     { "#comment" = "Test tomcat properties file" }
58     { "#comment" = "tomcat.commented.value=1" }
59     { "#comment" = "config" }
60     { "tomcat.port" = "8080" }
61     { "tomcat.application.name" = "testapp" }
62     { "tomcat.application.description" = "my test application" }
63     { "property.with_underscore" = "works" }
64     { "empty.property" }
65     { "empty.property.withtrailingspaces" }
66     { "!comment" = "more comments" }
67     { "key" = "value" }
68     { "key2" = "value2" }
69     { "key3" = "value3" }
70     { "key4" = "=value4" }
71     { "key5\"" = "value5" }
72     { "key6/c" = "value6" }
73     {}
74     { "long.description" = " < multi > "
75         { = "this is a description that happens to span " }
76         { = "more than one line with a combination of tabs and " }
77         { = "spaces " }
78         { = "or not" }
79     }
80     {}
81     { "#comment" = "comment break" }
82     {}
83     { "short.break" = " < multi > "
84         { = "a" }
85         { = "b" }
86     }
87     {}
88     { = "empty_key" }
89     { = "empty_key" }
90     {}
91     { "cheeses" }
92     {}
93     { "spaces" = "only" }
94     { "multi" = "spaces" }
95     { "indented" = "spaces" }
96     {}
97     { "\\=" = "A" }
98     { "space" = "and = equals" }
99     { "space" = " < multi > "
100         { = "with " }
101         { = "multiline" }
102     }
103     {}
104     { "escaped\:colon" = "value" }
105     { "escaped\=equals" = "value" }
106     { "escaped\ space" = "value" }
107 test lns put conf after
108     set "tomcat.port" "99";
109     set "tomcat.application.host" "foo.network.com"
110     = "
111 #
112 # Test tomcat properties file
113 #tomcat.commented.value=1
114     # config
115 tomcat.port = 99
116 tomcat.application.name=testapp
117     tomcat.application.description=my test application
118 property.with_underscore=works
119 empty.property=
120 empty.property.withtrailingspaces=   \n! more comments
121 key: value
122 key2:value2
123 key3 :value3
124 key4:=value4
125 key5\"=value5
126 key6/c=value6
127
128 long.description=this is a description that happens to span \
129         more than one line with a combination of tabs and \
130         spaces \  \nor not
131
132 # comment break
133
134 short.break = a\
135  b
136
137 =empty_key
138  =empty_key
139
140 cheeses
141
142 spaces only
143 multi  spaces
144   indented spaces
145
146 \= =A
147 space and = equals
148 space with \
149    multiline
150
151 escaped\:colon=value
152 escaped\=equals=value
153 escaped\ space=value
154 tomcat.application.host=foo.network.com
155 "
156
157 (* GH issue #19: value on new line *)
158 test lns get "k=\
159 b\
160 c\n" =
161     { "k" = " < multi > "
162       { } { = "b" } { = "c" } }
163
164 test lns get "tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
165 bootstrap.jar,commons-daemon.jar,tomcat-juli.jar\n" =
166     { "tomcat.util.scan.DefaultJarScanner.jarsToSkip" = " < multi > "
167       { } { = "bootstrap.jar,commons-daemon.jar,tomcat-juli.jar" } }
168
169
170 test lns get "# comment\r\na.b=val\r\nx=\r\n" =
171   { "#comment" = "comment" }
172   { "a.b" = "val" }
173   { "x" }
174
175 test lns get "# \r\n! \r\n" = { } { }