dc-kwalify 0.7.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/contrib/kwalify +1 -1
  4. data/dc-kwalify.gemspec +27 -0
  5. data/lib/kwalify/main.rb +1 -1
  6. data/lib/kwalify/util/testcase-helper.rb +1 -1
  7. data/lib/kwalify/version.rb +5 -0
  8. data/lib/kwalify.rb +1 -7
  9. metadata +83 -203
  10. data/setup.rb +0 -1585
  11. data/test/Rookbook.yaml +0 -10
  12. data/test/data/users-guide/AddressBook.java.expected +0 -40
  13. data/test/data/users-guide/BABEL.data.yaml +0 -24
  14. data/test/data/users-guide/BABEL.schema.yaml +0 -30
  15. data/test/data/users-guide/ExampleAddressBook.java +0 -47
  16. data/test/data/users-guide/Group.java.expected +0 -24
  17. data/test/data/users-guide/Person.java.expected +0 -44
  18. data/test/data/users-guide/address_book.rb +0 -52
  19. data/test/data/users-guide/address_book.schema.yaml +0 -28
  20. data/test/data/users-guide/address_book.yaml +0 -27
  21. data/test/data/users-guide/answers-schema.yaml +0 -12
  22. data/test/data/users-guide/answers-validator.rb +0 -52
  23. data/test/data/users-guide/babel_genclass.result +0 -26
  24. data/test/data/users-guide/config.schema.yaml +0 -7
  25. data/test/data/users-guide/config.yaml +0 -4
  26. data/test/data/users-guide/document01a.yaml +0 -3
  27. data/test/data/users-guide/document01b.yaml +0 -3
  28. data/test/data/users-guide/document02a.yaml +0 -4
  29. data/test/data/users-guide/document02b.yaml +0 -4
  30. data/test/data/users-guide/document03a.yaml +0 -6
  31. data/test/data/users-guide/document03b.yaml +0 -6
  32. data/test/data/users-guide/document04a.yaml +0 -9
  33. data/test/data/users-guide/document04b.yaml +0 -9
  34. data/test/data/users-guide/document05a.yaml +0 -11
  35. data/test/data/users-guide/document05b.yaml +0 -12
  36. data/test/data/users-guide/document06a.yaml +0 -15
  37. data/test/data/users-guide/document06b.yaml +0 -16
  38. data/test/data/users-guide/document07a.yaml +0 -9
  39. data/test/data/users-guide/document07b.yaml +0 -7
  40. data/test/data/users-guide/document12a.json +0 -10
  41. data/test/data/users-guide/document12b.json +0 -6
  42. data/test/data/users-guide/document13a.yaml +0 -17
  43. data/test/data/users-guide/document14a.yaml +0 -3
  44. data/test/data/users-guide/document14b.yaml +0 -3
  45. data/test/data/users-guide/document15a.yaml +0 -6
  46. data/test/data/users-guide/document15b.yaml +0 -5
  47. data/test/data/users-guide/example_address_book.rb +0 -10
  48. data/test/data/users-guide/example_address_book_java.result +0 -32
  49. data/test/data/users-guide/example_address_book_ruby.result +0 -31
  50. data/test/data/users-guide/genclass_java.result +0 -4
  51. data/test/data/users-guide/howto-validation-with-parsing.rb +0 -28
  52. data/test/data/users-guide/howto-validation.rb +0 -25
  53. data/test/data/users-guide/howto3.rb +0 -6
  54. data/test/data/users-guide/howto3.result +0 -5
  55. data/test/data/users-guide/howto3.yaml +0 -8
  56. data/test/data/users-guide/howto5_databinding.result +0 -111
  57. data/test/data/users-guide/invalid01.result +0 -3
  58. data/test/data/users-guide/invalid02.result +0 -5
  59. data/test/data/users-guide/invalid03.result +0 -5
  60. data/test/data/users-guide/invalid04.result +0 -4
  61. data/test/data/users-guide/invalid05.result +0 -11
  62. data/test/data/users-guide/invalid06.result +0 -4
  63. data/test/data/users-guide/invalid07.result +0 -3
  64. data/test/data/users-guide/invalid08.result +0 -3
  65. data/test/data/users-guide/invalid12.json +0 -8
  66. data/test/data/users-guide/invalid14.result +0 -4
  67. data/test/data/users-guide/invalid15.result +0 -4
  68. data/test/data/users-guide/loadbabel.rb +0 -27
  69. data/test/data/users-guide/loadconfig.rb +0 -16
  70. data/test/data/users-guide/loadconfig.result +0 -6
  71. data/test/data/users-guide/models.rb +0 -22
  72. data/test/data/users-guide/option_ha.result +0 -6
  73. data/test/data/users-guide/option_ha_genclass_java.result +0 -7
  74. data/test/data/users-guide/schema01.yaml +0 -3
  75. data/test/data/users-guide/schema02.yaml +0 -12
  76. data/test/data/users-guide/schema03.yaml +0 -9
  77. data/test/data/users-guide/schema04.yaml +0 -20
  78. data/test/data/users-guide/schema05.yaml +0 -29
  79. data/test/data/users-guide/schema06.yaml +0 -11
  80. data/test/data/users-guide/schema12.json +0 -12
  81. data/test/data/users-guide/schema13.yaml +0 -13
  82. data/test/data/users-guide/schema14.yaml +0 -5
  83. data/test/data/users-guide/schema15.yaml +0 -21
  84. data/test/data/users-guide/valid01.result +0 -2
  85. data/test/data/users-guide/valid02.result +0 -2
  86. data/test/data/users-guide/valid03.result +0 -2
  87. data/test/data/users-guide/valid04.result +0 -2
  88. data/test/data/users-guide/valid05.result +0 -2
  89. data/test/data/users-guide/valid06.result +0 -2
  90. data/test/data/users-guide/valid07.result +0 -2
  91. data/test/data/users-guide/valid08.result +0 -2
  92. data/test/data/users-guide/valid12.result +0 -2
  93. data/test/data/users-guide/valid13.result +0 -2
  94. data/test/data/users-guide/valid14.result +0 -2
  95. data/test/data/users-guide/valid15.result +0 -2
  96. data/test/data/users-guide/validate08.rb +0 -37
  97. data/test/test-action.rb +0 -78
  98. data/test/test-action.yaml +0 -738
  99. data/test/test-databinding.rb +0 -83
  100. data/test/test-databinding.yaml +0 -339
  101. data/test/test-main.rb +0 -157
  102. data/test/test-main.yaml +0 -415
  103. data/test/test-metavalidator.rb +0 -80
  104. data/test/test-metavalidator.yaml +0 -1179
  105. data/test/test-parser-yaml.rb +0 -57
  106. data/test/test-parser-yaml.yaml +0 -1749
  107. data/test/test-rule.rb +0 -26
  108. data/test/test-rule.yaml +0 -317
  109. data/test/test-users-guide.rb +0 -75
  110. data/test/test-util.rb +0 -125
  111. data/test/test-validator.rb +0 -95
  112. data/test/test-validator.yaml +0 -986
  113. data/test/test-yaml-parser.rb +0 -47
  114. data/test/test-yaml-parser.yaml +0 -1226
  115. data/test/test.rb +0 -61
@@ -1,1226 +0,0 @@
1
- ##
2
- ## $Rev$
3
- ## $Release: 0.7.2 $
4
- ## copyright(c) 2005-2010 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"=>{"enum"=>["exective", "manager", "clerk"], "type"=>"str"},
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
- ##