ddao-kwalify 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. data/CHANGES.txt +243 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.txt +61 -0
  4. data/bin/kwalify +13 -0
  5. data/contrib/inline-require +153 -0
  6. data/contrib/kwalify +4159 -0
  7. data/doc-api/classes/CommandOptionError.html +184 -0
  8. data/doc-api/classes/CommandOptionParser.html +325 -0
  9. data/doc-api/classes/Kwalify.html +292 -0
  10. data/doc-api/classes/Kwalify/AssertionError.html +148 -0
  11. data/doc-api/classes/Kwalify/BaseError.html +297 -0
  12. data/doc-api/classes/Kwalify/BaseParser.html +461 -0
  13. data/doc-api/classes/Kwalify/CommandOptionError.html +168 -0
  14. data/doc-api/classes/Kwalify/ErrorHelper.html +223 -0
  15. data/doc-api/classes/Kwalify/HashInterface.html +118 -0
  16. data/doc-api/classes/Kwalify/Json.html +105 -0
  17. data/doc-api/classes/Kwalify/KwalifyError.html +111 -0
  18. data/doc-api/classes/Kwalify/Main.html +339 -0
  19. data/doc-api/classes/Kwalify/MetaValidator.html +448 -0
  20. data/doc-api/classes/Kwalify/Parser.html +155 -0
  21. data/doc-api/classes/Kwalify/PlainYamlParser.html +523 -0
  22. data/doc-api/classes/Kwalify/PlainYamlParser/Alias.html +165 -0
  23. data/doc-api/classes/Kwalify/Rule.html +433 -0
  24. data/doc-api/classes/Kwalify/SchemaError.html +148 -0
  25. data/doc-api/classes/Kwalify/SyntaxError.html +185 -0
  26. data/doc-api/classes/Kwalify/Types.html +302 -0
  27. data/doc-api/classes/Kwalify/Util.html +389 -0
  28. data/doc-api/classes/Kwalify/Util/HashLike.html +246 -0
  29. data/doc-api/classes/Kwalify/Util/OrderedHash.html +330 -0
  30. data/doc-api/classes/Kwalify/ValidationError.html +148 -0
  31. data/doc-api/classes/Kwalify/Validator.html +381 -0
  32. data/doc-api/classes/Kwalify/Yaml.html +194 -0
  33. data/doc-api/classes/Kwalify/Yaml/Parser.html +1538 -0
  34. data/doc-api/classes/Kwalify/YamlParser.html +542 -0
  35. data/doc-api/classes/Kwalify/YamlSyntaxError.html +119 -0
  36. data/doc-api/classes/Test.html +107 -0
  37. data/doc-api/classes/Test/Unit.html +101 -0
  38. data/doc-api/created.rid +1 -0
  39. data/doc-api/files/__/README_txt.html +172 -0
  40. data/doc-api/files/kwalify/errors_rb.html +114 -0
  41. data/doc-api/files/kwalify/main_rb.html +118 -0
  42. data/doc-api/files/kwalify/messages_rb.html +107 -0
  43. data/doc-api/files/kwalify/meta-validator_rb.html +117 -0
  44. data/doc-api/files/kwalify/parser/base_rb.html +116 -0
  45. data/doc-api/files/kwalify/parser/yaml_rb.html +117 -0
  46. data/doc-api/files/kwalify/rule_rb.html +116 -0
  47. data/doc-api/files/kwalify/types_rb.html +114 -0
  48. data/doc-api/files/kwalify/util/assert-text-equal_rb.html +115 -0
  49. data/doc-api/files/kwalify/util/hash-interface_rb.html +114 -0
  50. data/doc-api/files/kwalify/util/hashlike_rb.html +107 -0
  51. data/doc-api/files/kwalify/util/option-parser_rb.html +107 -0
  52. data/doc-api/files/kwalify/util/ordered-hash_rb.html +107 -0
  53. data/doc-api/files/kwalify/util/testcase-helper_rb.html +115 -0
  54. data/doc-api/files/kwalify/util_rb.html +107 -0
  55. data/doc-api/files/kwalify/validator_rb.html +117 -0
  56. data/doc-api/files/kwalify/yaml-parser_rb.html +117 -0
  57. data/doc-api/files/kwalify_rb.html +121 -0
  58. data/doc-api/fr_class_index.html +57 -0
  59. data/doc-api/fr_file_index.html +45 -0
  60. data/doc-api/fr_method_index.html +168 -0
  61. data/doc-api/index.html +24 -0
  62. data/doc-api/rdoc-style.css +208 -0
  63. data/doc/docstyle.css +188 -0
  64. data/doc/img/fig01.png +0 -0
  65. data/doc/users-guide.html +2050 -0
  66. data/examples/address-book/Makefile +10 -0
  67. data/examples/address-book/address-book.schema.yaml +45 -0
  68. data/examples/address-book/address-book.yaml +36 -0
  69. data/examples/data-binding/BABEL.data.yaml +63 -0
  70. data/examples/data-binding/BABEL.schema.yaml +31 -0
  71. data/examples/data-binding/Makefile +8 -0
  72. data/examples/data-binding/Rakefile +13 -0
  73. data/examples/data-binding/main.rb +27 -0
  74. data/examples/invoice/Makefile +9 -0
  75. data/examples/invoice/invoice.schema.yaml +43 -0
  76. data/examples/invoice/invoice.yaml +32 -0
  77. data/examples/tapkit/Makefile +10 -0
  78. data/examples/tapkit/main.rb +7 -0
  79. data/examples/tapkit/tapkit.schema.yaml +146 -0
  80. data/examples/tapkit/tapkit.yaml +85 -0
  81. data/lib/kwalify.rb +67 -0
  82. data/lib/kwalify/errors.rb +128 -0
  83. data/lib/kwalify/kwalify.schema.yaml +58 -0
  84. data/lib/kwalify/main.rb +442 -0
  85. data/lib/kwalify/messages.rb +173 -0
  86. data/lib/kwalify/meta-validator.rb +276 -0
  87. data/lib/kwalify/parser/base.rb +127 -0
  88. data/lib/kwalify/parser/yaml.rb +841 -0
  89. data/lib/kwalify/rule.rb +560 -0
  90. data/lib/kwalify/templates/genclass-java.eruby +222 -0
  91. data/lib/kwalify/templates/genclass-php.eruby +104 -0
  92. data/lib/kwalify/templates/genclass-ruby.eruby +113 -0
  93. data/lib/kwalify/types.rb +156 -0
  94. data/lib/kwalify/util.rb +157 -0
  95. data/lib/kwalify/util/assert-text-equal.rb +46 -0
  96. data/lib/kwalify/util/hash-interface.rb +18 -0
  97. data/lib/kwalify/util/hashlike.rb +51 -0
  98. data/lib/kwalify/util/option-parser.rb +220 -0
  99. data/lib/kwalify/util/ordered-hash.rb +57 -0
  100. data/lib/kwalify/util/testcase-helper.rb +112 -0
  101. data/lib/kwalify/validator.rb +282 -0
  102. data/lib/kwalify/yaml-parser.rb +870 -0
  103. data/setup.rb +1585 -0
  104. data/test/Rookbook.yaml +10 -0
  105. data/test/data/users-guide/AddressBook.java.expected +40 -0
  106. data/test/data/users-guide/BABEL.data.yaml +24 -0
  107. data/test/data/users-guide/BABEL.schema.yaml +30 -0
  108. data/test/data/users-guide/ExampleAddressBook.java +47 -0
  109. data/test/data/users-guide/Group.java.expected +24 -0
  110. data/test/data/users-guide/Person.java.expected +44 -0
  111. data/test/data/users-guide/address_book.rb +52 -0
  112. data/test/data/users-guide/address_book.schema.yaml +28 -0
  113. data/test/data/users-guide/address_book.yaml +27 -0
  114. data/test/data/users-guide/answers-schema.yaml +12 -0
  115. data/test/data/users-guide/answers-validator.rb +52 -0
  116. data/test/data/users-guide/babel_genclass.result +26 -0
  117. data/test/data/users-guide/config.schema.yaml +7 -0
  118. data/test/data/users-guide/config.yaml +4 -0
  119. data/test/data/users-guide/document01a.yaml +3 -0
  120. data/test/data/users-guide/document01b.yaml +3 -0
  121. data/test/data/users-guide/document02a.yaml +4 -0
  122. data/test/data/users-guide/document02b.yaml +4 -0
  123. data/test/data/users-guide/document03a.yaml +6 -0
  124. data/test/data/users-guide/document03b.yaml +6 -0
  125. data/test/data/users-guide/document04a.yaml +9 -0
  126. data/test/data/users-guide/document04b.yaml +9 -0
  127. data/test/data/users-guide/document05a.yaml +11 -0
  128. data/test/data/users-guide/document05b.yaml +12 -0
  129. data/test/data/users-guide/document06a.yaml +15 -0
  130. data/test/data/users-guide/document06b.yaml +16 -0
  131. data/test/data/users-guide/document07a.yaml +9 -0
  132. data/test/data/users-guide/document07b.yaml +7 -0
  133. data/test/data/users-guide/document12a.json +10 -0
  134. data/test/data/users-guide/document12b.json +6 -0
  135. data/test/data/users-guide/document13a.yaml +17 -0
  136. data/test/data/users-guide/document14a.yaml +3 -0
  137. data/test/data/users-guide/document14b.yaml +3 -0
  138. data/test/data/users-guide/document15a.yaml +6 -0
  139. data/test/data/users-guide/document15b.yaml +5 -0
  140. data/test/data/users-guide/example_address_book.rb +10 -0
  141. data/test/data/users-guide/example_address_book_java.result +32 -0
  142. data/test/data/users-guide/example_address_book_ruby.result +31 -0
  143. data/test/data/users-guide/genclass_java.result +4 -0
  144. data/test/data/users-guide/howto-validation-with-parsing.rb +28 -0
  145. data/test/data/users-guide/howto-validation.rb +25 -0
  146. data/test/data/users-guide/howto3.rb +6 -0
  147. data/test/data/users-guide/howto3.result +5 -0
  148. data/test/data/users-guide/howto3.yaml +8 -0
  149. data/test/data/users-guide/howto5_databinding.result +111 -0
  150. data/test/data/users-guide/invalid01.result +3 -0
  151. data/test/data/users-guide/invalid02.result +5 -0
  152. data/test/data/users-guide/invalid03.result +5 -0
  153. data/test/data/users-guide/invalid04.result +4 -0
  154. data/test/data/users-guide/invalid05.result +11 -0
  155. data/test/data/users-guide/invalid06.result +4 -0
  156. data/test/data/users-guide/invalid07.result +3 -0
  157. data/test/data/users-guide/invalid08.result +3 -0
  158. data/test/data/users-guide/invalid12.json +8 -0
  159. data/test/data/users-guide/invalid14.result +4 -0
  160. data/test/data/users-guide/invalid15.result +4 -0
  161. data/test/data/users-guide/loadbabel.rb +27 -0
  162. data/test/data/users-guide/loadconfig.rb +16 -0
  163. data/test/data/users-guide/loadconfig.result +6 -0
  164. data/test/data/users-guide/models.rb +22 -0
  165. data/test/data/users-guide/option_ha.result +6 -0
  166. data/test/data/users-guide/option_ha_genclass_java.result +7 -0
  167. data/test/data/users-guide/schema01.yaml +3 -0
  168. data/test/data/users-guide/schema02.yaml +12 -0
  169. data/test/data/users-guide/schema03.yaml +9 -0
  170. data/test/data/users-guide/schema04.yaml +20 -0
  171. data/test/data/users-guide/schema05.yaml +29 -0
  172. data/test/data/users-guide/schema06.yaml +11 -0
  173. data/test/data/users-guide/schema12.json +12 -0
  174. data/test/data/users-guide/schema13.yaml +13 -0
  175. data/test/data/users-guide/schema14.yaml +5 -0
  176. data/test/data/users-guide/schema15.yaml +21 -0
  177. data/test/data/users-guide/valid01.result +2 -0
  178. data/test/data/users-guide/valid02.result +2 -0
  179. data/test/data/users-guide/valid03.result +2 -0
  180. data/test/data/users-guide/valid04.result +2 -0
  181. data/test/data/users-guide/valid05.result +2 -0
  182. data/test/data/users-guide/valid06.result +2 -0
  183. data/test/data/users-guide/valid07.result +2 -0
  184. data/test/data/users-guide/valid08.result +2 -0
  185. data/test/data/users-guide/valid12.result +2 -0
  186. data/test/data/users-guide/valid13.result +2 -0
  187. data/test/data/users-guide/valid14.result +2 -0
  188. data/test/data/users-guide/valid15.result +2 -0
  189. data/test/data/users-guide/validate08.rb +37 -0
  190. data/test/test-action.rb +78 -0
  191. data/test/test-action.yaml +738 -0
  192. data/test/test-databinding.rb +83 -0
  193. data/test/test-databinding.yaml +339 -0
  194. data/test/test-main.rb +157 -0
  195. data/test/test-main.yaml +384 -0
  196. data/test/test-metavalidator.rb +80 -0
  197. data/test/test-metavalidator.yaml +1179 -0
  198. data/test/test-parser-yaml.rb +57 -0
  199. data/test/test-parser-yaml.yaml +1749 -0
  200. data/test/test-rule.rb +26 -0
  201. data/test/test-rule.yaml +317 -0
  202. data/test/test-users-guide.rb +75 -0
  203. data/test/test-validator.rb +95 -0
  204. data/test/test-validator.yaml +986 -0
  205. data/test/test-yaml-parser.rb +47 -0
  206. data/test/test-yaml-parser.yaml +1226 -0
  207. data/test/test.rb +60 -0
  208. metadata +261 -0
@@ -0,0 +1,47 @@
1
+ ###
2
+ ### $Rev: 83 $
3
+ ### $Release: 0.7.1 $
4
+ ### copyright(c) 2005-2008 kuwata-lab all rights reserved.
5
+ ###
6
+
7
+ require File.dirname(__FILE__) + '/test.rb'
8
+
9
+
10
+ class ParserTest < Test::Unit::TestCase
11
+
12
+ filename = __FILE__.sub(/\.rb$/, '.yaml')
13
+ load_yaml_testdata(filename, :lang=>'ruby')
14
+
15
+ def _test()
16
+ if @exception
17
+ @error_class = @exception.split(/::/).inject(Kernel) { |k,s| k = k.const_get(s) }
18
+ #@error_class = Kwalify::YamlSyntaxError if @error_class == Kwalify::SyntaxError
19
+ end
20
+ parser = Kwalify::YamlParser.new(@input)
21
+ if @error_class
22
+ assert_raise(@error_class) do
23
+ doc = parser.parse()
24
+ end
25
+ else
26
+ doc = parser.parse()
27
+ #if @recursive || @pp
28
+ if @testopts && (@testopts['recursive'] || @testopts['pp'])
29
+ s = StringWriter.new
30
+ PP.pp(doc, s)
31
+ actual = s
32
+ else
33
+ actual = doc.inspect + "\n"
34
+ end
35
+ if $log
36
+ File.open("#{@name}.expected", 'w') { |f| f.write(@expected) }
37
+ File.open("#{@name}.actual", 'w') { |f| f.write(actual) }
38
+ end
39
+ if $print
40
+ print actual
41
+ else
42
+ assert_text_equal(@expected, actual)
43
+ end
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,1226 @@
1
+ ##
2
+ ## $Rev: 92 $
3
+ ## $Release: 0.7.1 $
4
+ ## copyright(c) 2005-2008 kuwata-lab all rights reserved.
5
+ ##
6
+ ---
7
+ name: sequence1
8
+ desc: basic sequence
9
+ input: |
10
+ - aaa
11
+ - bbb
12
+ - ccc
13
+ expected: |
14
+ ["aaa", "bbb", "ccc"]
15
+ ##
16
+ ---
17
+ name: sequence2
18
+ desc: nested sequence
19
+ input: |
20
+ - A
21
+ -
22
+ - B1
23
+ - B2
24
+ -
25
+ - B2.1
26
+ - B2.2
27
+ - C
28
+ expected: |
29
+ ["A", ["B1", "B2", ["B2.1", "B2.2"]], "C"]
30
+ ##
31
+ ---
32
+ name: sequence3
33
+ desc: null item of sequence
34
+ input: |
35
+ - A
36
+ -
37
+ - C
38
+ -
39
+ -
40
+ -
41
+ - G
42
+ expected: |
43
+ ["A", nil, "C", nil, nil, nil, "G"]
44
+ ##
45
+ ---
46
+ name: sequence4
47
+ desc: null item of nested sequence
48
+ #
49
+ input: |
50
+ -
51
+ -
52
+ -
53
+ -
54
+ -
55
+ -
56
+ #
57
+ expected: |
58
+ [[[nil, nil, nil]], nil]
59
+ ##
60
+ ---
61
+ name: sequence5
62
+ desc: sequence with empty lines
63
+ input: |
64
+
65
+ - A
66
+
67
+ -
68
+
69
+
70
+ - B
71
+
72
+
73
+ -
74
+ expected: |
75
+ ["A", ["B"], nil]
76
+ ##
77
+ ---
78
+ name: sequence6
79
+ desc: syntax error - invalid indent of sequence.
80
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
81
+ #
82
+ input: |
83
+ - AAA
84
+ - BBB1
85
+ - BBB2
86
+ - CCC
87
+ #
88
+ expected: |
89
+ ##
90
+ ---
91
+ name: sequence7
92
+ desc: syntax error - sequence item is exepcted.
93
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
94
+ input: |
95
+ -
96
+ - a1
97
+ - a2
98
+ a3
99
+ -
100
+ - b1
101
+ - b2
102
+ b3
103
+ expected: |
104
+ ##
105
+ ---
106
+ name: mapping1
107
+ desc: basic mapping
108
+ input: |
109
+ A: foo
110
+ B: bar
111
+ C : baz
112
+ expected: |
113
+ {"A"=>"foo", "B"=>"bar", "C"=>"baz"}
114
+ ##
115
+ ---
116
+ name: mapping2
117
+ desc: nested mapping
118
+ input: |
119
+ A: 10
120
+ B:
121
+ B1:
122
+ B1-1: 21
123
+ B1-2: 22
124
+ B1-3: 23
125
+ C: 30
126
+ expected: |
127
+ {"A"=>10, "B"=>{"B1"=>{"B1-1"=>21, "B1-2"=>22, "B1-3"=>23}}, "C"=>30}
128
+ ##
129
+ ---
130
+ name: mapping3
131
+ desc: null item in mapping
132
+ input: |
133
+ A:
134
+ B:
135
+ B1:
136
+ B1-2:
137
+ C:
138
+ expected: |
139
+ {"A"=>nil, "B"=>{"B1"=>{"B1-2"=>nil}}, "C"=>nil}
140
+ ##
141
+ ---
142
+ name: mapping4
143
+ desc: mapping with empty lines
144
+ input: |
145
+
146
+ A: 1
147
+
148
+ B:
149
+
150
+
151
+ B1:
152
+
153
+
154
+
155
+ B1a: 2
156
+ C: 3
157
+
158
+ expected: |
159
+ {"A"=>1, "B"=>{"B1"=>{"B1a"=>2}}, "C"=>3}
160
+ ##
161
+ ---
162
+ name: mapping5
163
+ desc: parse error - invalid indent of mapping.
164
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
165
+ input: |
166
+ A: 10
167
+ B: 20
168
+ B1: 21
169
+ B2: 22
170
+ C: 30
171
+ expected: |
172
+ ##
173
+ ---
174
+ name: mapping6
175
+ desc: parse error - mapping item is expected.
176
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
177
+ input: |
178
+ A:
179
+ a1: 1
180
+ a2: 2
181
+ a3 3
182
+ B:
183
+ b1: 1
184
+ b2: 2
185
+ b3 3
186
+ expected: |
187
+ ##
188
+ ---
189
+ name: combination1
190
+ desc: seq of mapping
191
+ #
192
+ input: |
193
+ -
194
+ x: 10
195
+ y: 20
196
+ -
197
+ x: 15
198
+ y: 25
199
+ #
200
+ expected: |
201
+ [{"x"=>10, "y"=>20}, {"x"=>15, "y"=>25}]
202
+ ##
203
+ ---
204
+ name: combination2
205
+ desc: seq of mapping (in same line)
206
+ #
207
+ input: |
208
+ - x: 10
209
+ y: 20
210
+ - x: 15
211
+ y: 25
212
+ #
213
+ expected: |
214
+ [{"x"=>10, "y"=>20}, {"x"=>15, "y"=>25}]
215
+ ##
216
+ ---
217
+ name: combination3
218
+ desc: seq of seq of seq
219
+ #
220
+ input: |
221
+ - - - a
222
+ - b
223
+ - - - c
224
+ - d
225
+ #
226
+ expected: |
227
+ [[["a", "b"]], [["c", "d"]]]
228
+ ##
229
+ ---
230
+ name: combination4
231
+ desc: map of sequence
232
+ #
233
+ input: |
234
+ A:
235
+ - 1
236
+ - 2
237
+ - 3
238
+ B:
239
+ - 4
240
+ - 5
241
+ - 6
242
+ #
243
+ expected: |
244
+ {"A"=>[1, 2, 3], "B"=>[4, 5, 6]}
245
+ ##
246
+ ---
247
+ name: combination5
248
+ desc: map of sequence (in same line)
249
+ #
250
+ input: |
251
+ A: - 1
252
+ - 2
253
+ - 3
254
+ B: - 4
255
+ - 5
256
+ - 6
257
+ #
258
+ expected: |
259
+ {"A"=>[1, 2, 3], "B"=>[4, 5, 6]}
260
+ ##
261
+ ---
262
+ name: combination6
263
+ desc: map of map of map
264
+ #
265
+ input: |
266
+ A: a: 1: 100
267
+ 2: 200
268
+ B: b: 3: 300
269
+ "4": 400
270
+ #
271
+ expected: |
272
+ {"A"=>{"a"=>{1=>100, 2=>200}}, "B"=>{"b"=>{3=>300, "4"=>400}}}
273
+ ##
274
+ ---
275
+ name: comment1
276
+ desc: line comment
277
+ input: |
278
+ # comment
279
+ - A
280
+ - B
281
+ # comment
282
+ -
283
+ # comment
284
+ - C
285
+ #
286
+ expected: |
287
+ ["A", "B", ["C"]]
288
+ ##
289
+ ---
290
+ name: comment2
291
+ desc: escape line comment
292
+ #
293
+ input: |
294
+ # comment
295
+ - A
296
+ - B:
297
+ "# comment"
298
+ -
299
+ '# comment'
300
+ #
301
+ expected: |
302
+ ["A", {"B"=>"# comment"}, "# comment"]
303
+ ##
304
+ ---
305
+ name: comment3
306
+ desc: line comment with seq and map
307
+ #
308
+ input: |
309
+ - A # comment
310
+ - B: # comment
311
+ C: foo # comment
312
+ D: "bar#bar" #comment
313
+ #
314
+ expected: |
315
+ ["A", {"B"=>{"C"=>"foo", "D"=>"bar#bar"}}]
316
+ ##
317
+ ---
318
+ name: comment4
319
+ desc: line comment with anchor and alias
320
+ #
321
+ input: |
322
+ - &a1 # comment
323
+ foo
324
+ - *a1 # comment
325
+ #
326
+ expected: |
327
+ ["foo", "foo"]
328
+ ##
329
+ ---
330
+ name: flowseq1
331
+ desc: flow style sequence
332
+ #
333
+ input: |
334
+ - [ 10, 20 ]
335
+ - [15,25,35]
336
+ #
337
+ expected: |
338
+ [[10, 20], [15, 25, 35]]
339
+ # [[10, 20], ["15,25,35"]]
340
+ ##
341
+ ---
342
+ name: flowseq2
343
+ desc: nested flow style sequence
344
+ #
345
+ input: |
346
+ 1: [ A, [B1, B2]]
347
+ '2': [[[X]]]
348
+ 3: [[1, 1], [2, "2"], ['3', 3]]
349
+ #
350
+ expected: |
351
+ {1=>["A", ["B1", "B2"]], "2"=>[[["X"]]], 3=>[[1, 1], [2, "2"], ["3", 3]]}
352
+ #expected: |
353
+ # {1=>["A", ["B1", "B2"]],
354
+ # "2"=>[[["X"]]],
355
+ # 3=>[["x1", "y1"], ["x2", "y2"], ["x3", "y3"]]}
356
+ ##
357
+ ---
358
+ name: flowseq3
359
+ desc: flow style sequence with some lines
360
+ #
361
+ input: |
362
+ A: [ [10, 20],
363
+ [11, 21],
364
+ [12, 22]]
365
+ B: [
366
+ [1.1,
367
+ 1.2,
368
+ 1.3
369
+ ]
370
+ ]
371
+ #
372
+ expected: |
373
+ {"A"=>[[10, 20], [11, 21], [12, 22]], "B"=>[[1.1, 1.2, 1.3]]}
374
+ ##
375
+ ---
376
+ name: flowseq4
377
+ desc: invalid flow style seq (sequence item required (or last comma is extra).)
378
+ mesg: sequence item required (or last comma is extra).
379
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
380
+ #
381
+ input: |
382
+ A: [ [10,20], ]
383
+ #
384
+ expected: |
385
+ ##
386
+ ---
387
+ name: flowseq5
388
+ desc: invalid flow style seq (flow style sequence requires ']').
389
+ mesg: flow style sequence requires ']'
390
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
391
+ #
392
+ input: |
393
+ A: [ [10,20]
394
+ B: [ [30, 40]]
395
+ #
396
+ expected: |
397
+ ##
398
+ ---
399
+ name: flowseq6
400
+ desc: invalid flow style seq (flow style sequence requires ']').
401
+ mesg: flow style sequence is closed but got ']'.
402
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
403
+ #
404
+ input: |
405
+ [ 10 ]]
406
+ #
407
+ expected: |
408
+ ##
409
+ ---
410
+ name: flowmap1
411
+ desc: flow style map
412
+ #
413
+ input: |
414
+ - { A1: 10, A2: 20 }
415
+ - {B1: 15, 'B2': 25, "B3": 35}
416
+ #
417
+ expected: |
418
+ [{"A1"=>10, "A2"=>20}, {"B1"=>15, "B2"=>25, "B3"=>35}]
419
+ ##
420
+ ---
421
+ name: flowmap2
422
+ desc: flow style map nested
423
+ #
424
+ input: |
425
+ A: { x: {y: {z: 10}}}
426
+ B: { a: 1, b: {c: 2, d: 3, e: {f: 4}}, g: 5}
427
+ #
428
+ expected: |
429
+ {"A"=>{"x"=>{"y"=>{"z"=>10}}}, "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
430
+ #expected: |
431
+ # {"A"=>{"x"=>{"y"=>{"z"=>10}}},
432
+ # "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
433
+ ##
434
+ ---
435
+ name: flowmap3
436
+ desc: flow style map with some lines
437
+ #
438
+ input: |
439
+ A: { x:
440
+ {y:
441
+ {z: 10}
442
+ }
443
+ }
444
+ B: {
445
+ a: 1,
446
+ b: {
447
+ c: 2,
448
+ d: 3,
449
+ e: {
450
+ f: 4
451
+ }
452
+ },
453
+ g: 5
454
+ }
455
+ #
456
+ expected: |
457
+ {"A"=>{"x"=>{"y"=>{"z"=>10}}}, "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
458
+ #expected: |
459
+ # {"A"=>{"x"=>{"y"=>{"z"=>10}}},
460
+ # "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
461
+ ##
462
+ ---
463
+ name: flowmap4
464
+ desc: invalid flow style map (mapping item required (or last comma is extra).)
465
+ mesg: mapping item required (or last comma is extra).
466
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
467
+ #
468
+ input: |
469
+ - {A: 10, B: 20, }
470
+ #
471
+ expected: |
472
+ ##
473
+ ---
474
+ name: flowmap5
475
+ desc: invalid flow style map (flow style mapping requires '}').
476
+ mesg: flow style mapping requires '}'
477
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
478
+ #
479
+ input: |
480
+ - {A: { x: 10, y: 20 }
481
+ - {A: { x: 11, y: 21 }}
482
+ #
483
+ expected: |
484
+ ##
485
+ ---
486
+ name: flowmap6
487
+ desc: invalid flow style map (flow style mapping requires ']').
488
+ mesg: flow style mapping is closed but got '}'.
489
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
490
+ #
491
+ input: |
492
+ { x: 10 }}
493
+ #
494
+ expected: |
495
+ ##
496
+ ---
497
+ name: flowscalar1
498
+ desc: string containing backslash escape
499
+ #
500
+ input: |
501
+ [ {"key1": "\"\\\n"},
502
+ {'key2': '\'\\\n'} ]
503
+ #
504
+ expected: |
505
+ [{"key1"=>"\"\\\n"}, {"key2"=>"'\\\\n"}]
506
+ ##
507
+ ---
508
+ name: flowcombination1
509
+ desc: combination of flow style seq and map
510
+ #
511
+ input: |
512
+ [
513
+ {name: ' foo ',
514
+ e-mail: foo@mail.com},
515
+ {name: ba z,
516
+ e-mail: ba__z@mail.com }
517
+ ]
518
+ #
519
+ expected: |
520
+ [{"e-mail"=>"foo@mail.com", "name"=>" foo "}, {"e-mail"=>"ba__z@mail.com", "name"=>"ba z"}]
521
+ ##
522
+ ---
523
+ name: blocktext01
524
+ desc: parse_blocktext
525
+ #
526
+ input: |
527
+ - text1: |
528
+ foo
529
+ bar
530
+ baz
531
+ - text2: |
532
+ aaa
533
+ bbb
534
+ ccc
535
+ - |
536
+ foo
537
+ bar
538
+ baz
539
+ - |
540
+ aaa
541
+ bbb
542
+ ccc
543
+ #
544
+ expected: |
545
+ [{"text1"=>"foo\nbar\nbaz\n"}, {"text2"=>"aaa\n bbb\n ccc\n"}, "foo\nbar\nbaz\n", "aaa\n bbb\n ccc\n"]
546
+ ##
547
+ ---
548
+ name: blocktext02
549
+ desc: block text with '|+' or '|-'
550
+ #
551
+ input: |
552
+ - text1: |
553
+ A
554
+
555
+ B
556
+ C
557
+
558
+
559
+ - text2: |+
560
+ A
561
+
562
+ B
563
+ C
564
+
565
+
566
+ - text3: |-
567
+ A
568
+
569
+ B
570
+ C
571
+
572
+
573
+ #
574
+ expected: |
575
+ [{"text1"=>"A\n\nB\nC\n"}, {"text2"=>"A\n\nB\nC\n\n\n"}, {"text3"=>"A\n\nB\nC"}]
576
+ ##
577
+ ---
578
+ name: blocktext03
579
+ desc: block text with '|n'
580
+ #
581
+ input: |
582
+ - text1: |3
583
+ A
584
+
585
+ B
586
+ C
587
+
588
+
589
+ - text2: |+3
590
+ A
591
+
592
+ B
593
+ C
594
+
595
+
596
+ - text3: |-3
597
+ A
598
+
599
+ B
600
+ C
601
+
602
+
603
+ #
604
+ expected: |
605
+ [{"text1"=>" A\n\n B\n C\n"}, {"text2"=>" A\n\n B\n C\n\n\n"}, {"text3"=>" A\n\n B\n C"}]
606
+ ##
607
+ ---
608
+ name: blocktext04
609
+ desc: block text with '| foo'
610
+ #
611
+ input: |
612
+ - text1: | foo
613
+ A
614
+
615
+ B
616
+ C
617
+
618
+ - | foo
619
+ A
620
+ B
621
+ C
622
+ #
623
+ expected: |
624
+ [{"text1"=>"foo A\n\nB\nC\n"}, "fooA\n B\n C\n"]
625
+ ##
626
+ ---
627
+ name: blocktext05
628
+ desc: block text with '#' (comment)
629
+ #
630
+ input: |
631
+ #
632
+ - text1: |
633
+ A
634
+ #
635
+ B
636
+ #
637
+ text2: |
638
+ #
639
+ #
640
+ #
641
+ - |
642
+ A
643
+ #
644
+ B
645
+ #
646
+ - |
647
+ #
648
+ #
649
+ #
650
+ - x
651
+
652
+ #
653
+ expected: |
654
+ [{"text1"=>"A\n#\nB\n", "text2"=>"#\n#\n"}, "A\n#\nB\n", "#\n#\n", "x"]
655
+ ##
656
+ #---
657
+ #name: blocktext06
658
+ #desc: invalid block text
659
+ #exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
660
+ ##
661
+ #input: |
662
+ # - |
663
+ # a
664
+ # b
665
+ # c
666
+ ##
667
+ #expected: |
668
+ ###
669
+ ---
670
+ name: blocktext11
671
+ desc: parse_blocktext (>)
672
+ #
673
+ input: |
674
+ - text1: >
675
+ foo
676
+ bar
677
+ baz
678
+ - text2: >
679
+ aaa
680
+ bbb
681
+ ccc
682
+ - >
683
+ foo
684
+ bar
685
+ baz
686
+ - >
687
+ aaa
688
+ bbb
689
+ ccc
690
+ #
691
+ expected: |
692
+ [{"text1"=>"foo bar baz\n"}, {"text2"=>"aaa bbb ccc\n"}, "foo bar baz\n", "aaa bbb ccc\n"]
693
+ ##
694
+ ---
695
+ name: blocktext12
696
+ desc: block text with '>+' or '>-'
697
+ #
698
+ input: |
699
+ - text1: >
700
+ A
701
+
702
+ B
703
+ C
704
+
705
+
706
+ - text2: >+
707
+ A
708
+
709
+ B
710
+ C
711
+
712
+
713
+ - text3: >-
714
+ A
715
+
716
+ B
717
+ C
718
+
719
+
720
+ #
721
+ expected: |
722
+ [{"text1"=>"A\nB C\n"}, {"text2"=>"A\nB C\n\n\n"}, {"text3"=>"A\nB C"}]
723
+ ##
724
+ ---
725
+ name: blocktext13
726
+ desc: block text with '>n'
727
+ #
728
+ input: |
729
+ - >2
730
+ A
731
+
732
+ B
733
+ C
734
+
735
+
736
+ - >+2
737
+ A
738
+
739
+ B
740
+ C
741
+
742
+
743
+ - >-2
744
+ A
745
+
746
+ B
747
+ C
748
+
749
+
750
+ #
751
+ expected: |
752
+ [" A\n B C\n", " A\n B C\n\n\n", " A\n B C"]
753
+ # [" A\n\n B\n C\n", " A\n\n B\n C\n\n\n", " A\n\n B\n C"]
754
+ ##
755
+ ---
756
+ name: blocktext14
757
+ desc: block text with '> foo'
758
+ #
759
+ input: |
760
+ - text1: > foo
761
+ A
762
+
763
+ B
764
+ C
765
+
766
+ - > foo
767
+ A
768
+ B
769
+ C
770
+ #
771
+ expected: |
772
+ [{"text1"=>"foo A\nB C\n"}, "fooA B C\n"]
773
+ ##
774
+ ---
775
+ name: blocktext15
776
+ desc: block text with '#' (comment)
777
+ #
778
+ input: |
779
+ #
780
+ - text1: >
781
+ AA
782
+ ##
783
+ BB
784
+ #
785
+ text2: >
786
+ #
787
+ #
788
+ #
789
+ - >
790
+ AA
791
+ ##
792
+ BB
793
+ #
794
+ - >
795
+ #
796
+ #
797
+ #
798
+ - x
799
+
800
+ #
801
+ expected: |
802
+ [{"text1"=>"AA ## BB\n", "text2"=>"# #\n"}, "AA ## BB\n", "# #\n", "x"]
803
+ ##
804
+ #---
805
+ #name: blocktext16
806
+ #desc: invalid block text
807
+ #exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
808
+ ##
809
+ #input: |
810
+ # - >
811
+ # a
812
+ # b
813
+ # c
814
+ ##
815
+ #expected: |
816
+ ###
817
+ ---
818
+ name: anchor1
819
+ desc: parse_anchor, parse_alias
820
+ #
821
+ input: |
822
+ - &a1 foo
823
+ - &a2
824
+ bar
825
+ - *a1
826
+ - *a2
827
+ #
828
+ expected: |
829
+ ["foo", "bar", "foo", "bar"]
830
+ ##
831
+ ---
832
+ name: anchor2
833
+ desc: parse_anchor, parse_alias
834
+ #
835
+ input: |
836
+ - A: &a1
837
+ x: 10
838
+ y: 20
839
+ - B: bar
840
+ - C: *a1
841
+ #
842
+ expected: |
843
+ [{"A"=>{"x"=>10, "y"=>20}}, {"B"=>"bar"}, {"C"=>{"x"=>10, "y"=>20}}]
844
+ ##
845
+ ---
846
+ name: anchor3
847
+ desc: anchor on child node
848
+ testopts: { recursive: yes }
849
+ #
850
+ input: |
851
+ - A: &a1
852
+ x: 10
853
+ y: 20
854
+ z: *a1
855
+ #
856
+ expected: |
857
+ [{"A"=>{"x"=>10, "y"=>20, "z"=>{...}}}]
858
+ ##
859
+ ---
860
+ name: anchor4
861
+ desc: preceding anchor
862
+ #
863
+ input: |
864
+ - *a1
865
+ - *a1
866
+ - foo
867
+ - &a1 bar
868
+ #
869
+ expected: |
870
+ ["bar", "bar", "foo", "bar"]
871
+ ##
872
+ ---
873
+ name: anchor5
874
+ desc: anchor not found
875
+ exception*: { ruby: Kwalify::YamlSyntaxError, java: kwalify.SyntaxException }
876
+ mesg: anchor 'a2' not found (Kwalify::YamlSyntaxError)
877
+ #
878
+ input: |
879
+ - &a1 foo
880
+ - bar
881
+ - *a2
882
+ #
883
+ expected: |
884
+ ##
885
+ ---
886
+ name: anchor6
887
+ desc: anchor on child node
888
+ testopts: { recursive: yes }
889
+ #
890
+ input: |
891
+ type: seq
892
+ sequence:
893
+ - &employee
894
+ type: map
895
+ mapping:
896
+ name:
897
+ type: str
898
+ post:
899
+ type: str
900
+ enum:
901
+ - exective
902
+ - manager
903
+ - clerk
904
+ supervisor: *employee
905
+ #
906
+ expected*:
907
+ ruby: |
908
+ {"sequence"=>
909
+ [{"type"=>"map",
910
+ "mapping"=>
911
+ {"name"=>{"type"=>"str"},
912
+ "post"=>{"type"=>"str", "enum"=>["exective", "manager", "clerk"]},
913
+ "supervisor"=>{...}}}],
914
+ "type"=>"seq"}
915
+ java: |
916
+ {"sequence"=>[{"mapping"=>{"name"=>{"type"=>"str"}, "post"=>{"enum"=>["exective", "manager", "clerk"], "type"=>"str"}, "supervisor"=>{...}}, "type"=>"map"}], "type"=>"seq"}
917
+ ##
918
+ ---
919
+ name: anchor7
920
+ desc: anchor and alias with flow style data
921
+ #
922
+ input: |
923
+ - &a1 {v: &a2 [1, 2, 3]}
924
+ - [x, *a1, y]
925
+ - {z: *a2}
926
+ #
927
+ expected*:
928
+ ruby: |
929
+ [{"v"=>[1, 2, 3]}, ["x", {"v"=>[1, 2, 3]}, "y"], {"z"=>[1, 2, 3]}]
930
+ java: |
931
+ [{"v"=>[1, 2, 3]}, ["x", {"v"=>[1, 2, 3]}, "y"], {"z"=>[1, 2, 3]}]
932
+ ##
933
+ ---
934
+ name: anchor8
935
+ desc: recursive alias with flow style data
936
+ testopts: { recursive: yes }
937
+ #
938
+ input: |
939
+ - &a1
940
+ {v: &a2 [*a1, *a2]}
941
+ #
942
+ expected*:
943
+ ruby: |
944
+ [{"v"=>[{...}, [...]]}]
945
+ java: |
946
+ [{"v"=>[{...}, [...]]}]
947
+ ##
948
+ ---
949
+ name: preceding1
950
+ desc: preceding anchor
951
+ testopts: { allow_preceding_alias: yes }
952
+ #
953
+ input: |
954
+ - *a1
955
+ - &a1 AAA
956
+ #
957
+ expected*:
958
+ ruby: |
959
+ ["AAA", "AAA"]
960
+ java: |
961
+ ["AAA", "AAA"]
962
+ ##
963
+ ---
964
+ name: preceding2
965
+ desc: preceding anchor
966
+ testopts: { allow_preceding_alias: yes, pp: yes }
967
+ #
968
+ input: |
969
+ groups:
970
+ - name: wheel
971
+ owner: *ROOT
972
+ - name: users
973
+ owner: *USER1
974
+
975
+ users:
976
+ - &ROOT
977
+ name: root
978
+ email: root@localhost
979
+ - &USER1
980
+ name: user1
981
+ email: user1@localhost
982
+ #
983
+ expected*:
984
+ ruby: |
985
+ {"groups"=>
986
+ [{"name"=>"wheel", "owner"=>{"name"=>"root", "email"=>"root@localhost"}},
987
+ {"name"=>"users", "owner"=>{"name"=>"user1", "email"=>"user1@localhost"}}],
988
+ "users"=>
989
+ [{"name"=>"root", "email"=>"root@localhost"},
990
+ {"name"=>"user1", "email"=>"user1@localhost"}]}
991
+ java: |
992
+ ##
993
+ ---
994
+ name: preceding3
995
+ desc: preceding anchor not found
996
+ testopts: { allow_preceding_alias: yes }
997
+ #
998
+ input: |
999
+ groups:
1000
+ - name: wheel
1001
+ owner: *ROOT
1002
+ - name: users
1003
+ owner: *USER1
1004
+
1005
+ users:
1006
+ - &ROOT
1007
+ name: root
1008
+ email: root@localhost
1009
+ - &USER2
1010
+ name: user1
1011
+ email: user1@localhost
1012
+ #
1013
+ exception*:
1014
+ ruby: Kwalify::YamlSyntaxError
1015
+ #java: kwalify.SyntaxError
1016
+ errormsg*:
1017
+ ruby: "*USER1: anchor not found."
1018
+ #java: "*USER1: anchor not found."
1019
+ location: { linenum: 5, column: 13 }
1020
+ ##
1021
+ ---
1022
+ name: tag1
1023
+ desc: tag
1024
+ #
1025
+ input: |
1026
+ - !str 123
1027
+ - foo: !text 123
1028
+ #
1029
+ expected: |
1030
+ [123, {"foo"=>123}]
1031
+ ##
1032
+ ---
1033
+ name: docend1
1034
+ desc: ... (document end)
1035
+ #
1036
+ input: |
1037
+ - aaa
1038
+ - bbb
1039
+ ...
1040
+ - ccc
1041
+ #
1042
+ expected: |
1043
+ ["aaa", "bbb"]
1044
+ ##
1045
+ ---
1046
+ name: docend2
1047
+ desc: ... (document end) in block text
1048
+ #
1049
+ input: |
1050
+ - |
1051
+ foo
1052
+ ...
1053
+ bar
1054
+ #
1055
+ expected: |
1056
+ ["foo\n...\nbar\n"]
1057
+ ##
1058
+ ---
1059
+ name: docstart1
1060
+ desc: --- (document start)
1061
+ #
1062
+ input: |
1063
+ # comment
1064
+ ---
1065
+ - foo
1066
+ - bar
1067
+ #
1068
+ expected: |
1069
+ ["foo", "bar"]
1070
+ ##
1071
+ ---
1072
+ name: docstart2
1073
+ desc: --- (document start) with tag
1074
+ #
1075
+ input: |
1076
+ # comment
1077
+ --- %YAML !seq
1078
+ - foo
1079
+ - bar
1080
+ #
1081
+ expected: |
1082
+ ["foo", "bar"]
1083
+ ##
1084
+ ---
1085
+ name: docstart3
1086
+ desc: --- (document start) with tag
1087
+ #
1088
+ input: |
1089
+ - |
1090
+ foo
1091
+ ---
1092
+ bar
1093
+ ---
1094
+ baz
1095
+ #
1096
+ expected: |
1097
+ ["foo\n---\nbar\n---\nbaz\n"]
1098
+ ##
1099
+ ---
1100
+ name: default1
1101
+ desc: map default value
1102
+ #
1103
+ input: |
1104
+ - A: 10
1105
+ B: 20
1106
+ =: -1
1107
+ - K:
1108
+ x: 10
1109
+ y: 20
1110
+ =:
1111
+ x: 0
1112
+ y: 0
1113
+ #
1114
+ expected: |
1115
+ [{"A"=>10, "B"=>20}, {"K"=>{"x"=>10, "y"=>20}}]
1116
+ ##
1117
+ ---
1118
+ name: merge1
1119
+ desc: merge key '<<'
1120
+ #
1121
+ input: |
1122
+ - &a1
1123
+ A: 10
1124
+ B: 20
1125
+ - C: 30
1126
+ <<: *a1
1127
+ A: ~
1128
+ #
1129
+ expected: |
1130
+ [{"A"=>10, "B"=>20}, {"A"=>nil, "B"=>20, "C"=>30}]
1131
+ ##
1132
+ ---
1133
+ name: scalar1
1134
+ desc: scalar with sequence
1135
+ input: |
1136
+ - abc
1137
+ - 123
1138
+ - 3.14
1139
+ - true
1140
+ - false
1141
+ - yes
1142
+ - no
1143
+ - ~
1144
+ - null
1145
+ - "123"
1146
+ - '456'
1147
+ - 2005-01-01
1148
+ - :sym
1149
+ expected*:
1150
+ ruby: |
1151
+ ["abc", 123, 3.14, true, false, true, false, nil, nil, "123", "456", #<Date: 4906743/2,0,2299161>, :sym]
1152
+ # ruby: |
1153
+ # ["abc",
1154
+ # 123,
1155
+ # 3.14,
1156
+ # true,
1157
+ # false,
1158
+ # true,
1159
+ # false,
1160
+ # nil,
1161
+ # nil,
1162
+ # "123",
1163
+ # "456",
1164
+ # #<Date: 4906743/2,0,2299161>,
1165
+ # :sym]
1166
+ java: |
1167
+ ["abc", 123, 3.14, true, false, true, false, nil, nil, "123", "456", Tue Feb 01 00:00:00 JST 2005, ":sym"]
1168
+ # ["abc", 123, true, false, true, false, nil, nil, "123", "456", #<Date: 4906743/2,0,2299161>, :sym]
1169
+ ##
1170
+ ---
1171
+ name: scalar2
1172
+ desc: mapping of scalar
1173
+ testopts: { pp: yes }
1174
+ input: |
1175
+ - abc : ABC
1176
+ - 123 : 123
1177
+ - 3.14 : 3.14
1178
+ - true : true
1179
+ - false : false
1180
+ - yes : yes
1181
+ - no : no
1182
+ - null : ~
1183
+ - null : null
1184
+ - "123" : "123"
1185
+ - '456' : '456'
1186
+ - 2005-01-01 : 2005-01-01
1187
+ - :sym : :sym
1188
+ # - ~ : ~
1189
+ # - 2005-01-01 00:00:00 : 2005-01-01 00:00:00
1190
+ expected*:
1191
+ ruby: |
1192
+ [{"abc"=>"ABC"},
1193
+ {123=>123},
1194
+ {3.14=>3.14},
1195
+ {true=>true},
1196
+ {false=>false},
1197
+ {true=>true},
1198
+ {false=>false},
1199
+ {nil=>nil},
1200
+ {nil=>nil},
1201
+ {"123"=>"123"},
1202
+ {"456"=>"456"},
1203
+ {#<Date: 4906743/2,0,2299161>=>#<Date: 4906743/2,0,2299161>},
1204
+ {:sym=>:sym}]
1205
+ java: |
1206
+ [{"abc"=>"ABC"}, {123=>123}, {3.14=>3.14}, {true=>true}, {false=>false}, {true=>true}, {false=>false}, "~ : ~", {nil=>nil}, {"123"=>"123"}, {"456"=>"456"}, {Tue Feb 01 00:00:00 JST 2005=>Tue Feb 01 00:00:00 JST 2005}, {":sym"=>":sym"}]
1207
+ # {123=>1.23, 3.14=>314, "abc"=>"ABC"}
1208
+ # {"abc"=>"ABC", 3.14=>314, 123=>1.23}
1209
+ ##
1210
+ ---
1211
+ name: mapkey1
1212
+ desc: mapping key test
1213
+ input: |
1214
+ - key1: A
1215
+ - .key.2: B
1216
+ - key3*: C
1217
+ - :key4: D
1218
+ # - k:e:y:5: E
1219
+ expected*:
1220
+ ruby: |
1221
+ [{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}]
1222
+ # [{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}, {"k:e:y:5"=>"E"}]
1223
+ java: |
1224
+ [{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}]
1225
+ # [{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}, {"k:e:y:5"=>"E"}]
1226
+ ##