kwalify 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +24 -19
- data/README.txt +51 -51
- data/bin/kwalify +2 -2
- data/contrib/inline-require +151 -0
- data/contrib/kwalify +2850 -0
- data/doc-api/classes/CommandOptionError.html +184 -0
- data/doc-api/classes/CommandOptionParser.html +325 -0
- data/doc-api/classes/Kwalify.html +270 -0
- data/doc-api/classes/Kwalify/AssertionError.html +148 -0
- data/doc-api/classes/Kwalify/BaseError.html +296 -0
- data/doc-api/classes/Kwalify/CommandOptionError.html +168 -0
- data/doc-api/classes/Kwalify/ErrorHelper.html +218 -0
- data/doc-api/classes/Kwalify/HashInterface.html +240 -0
- data/doc-api/classes/Kwalify/KwalifyError.html +111 -0
- data/doc-api/classes/Kwalify/Main.html +336 -0
- data/doc-api/classes/Kwalify/MetaValidator.html +432 -0
- data/doc-api/classes/Kwalify/Parser.html +155 -0
- data/doc-api/classes/Kwalify/PlainYamlParser.html +520 -0
- data/doc-api/classes/Kwalify/PlainYamlParser/Alias.html +165 -0
- data/doc-api/classes/Kwalify/Rule.html +411 -0
- data/doc-api/classes/Kwalify/SchemaError.html +148 -0
- data/doc-api/classes/Kwalify/Types.html +301 -0
- data/doc-api/classes/Kwalify/ValidationError.html +148 -0
- data/doc-api/classes/Kwalify/Validator.html +311 -0
- data/doc-api/classes/Kwalify/YamlParser.html +535 -0
- data/doc-api/classes/Kwalify/YamlSyntaxError.html +168 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/classes/YamlHelper.html +259 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +179 -0
- data/doc-api/files/kwalify/errors_rb.html +114 -0
- data/doc-api/files/kwalify/main_rb.html +117 -0
- data/doc-api/files/kwalify/messages_rb.html +107 -0
- data/doc-api/files/kwalify/meta-validator_rb.html +117 -0
- data/doc-api/files/kwalify/rule_rb.html +116 -0
- data/doc-api/files/kwalify/types_rb.html +114 -0
- data/doc-api/files/kwalify/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwalify/util/hash-interface_rb.html +107 -0
- data/doc-api/files/kwalify/util/option-parser_rb.html +107 -0
- data/doc-api/files/kwalify/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwalify/util/yaml-helper_rb.html +114 -0
- data/doc-api/files/kwalify/validator_rb.html +117 -0
- data/doc-api/files/kwalify/yaml-parser_rb.html +117 -0
- data/doc-api/files/kwalify_rb.html +120 -0
- data/doc-api/fr_class_index.html +50 -0
- data/doc-api/fr_file_index.html +41 -0
- data/doc-api/fr_method_index.html +109 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/users-guide.html +693 -193
- data/examples/address-book/Makefile +5 -0
- data/examples/address-book/address-book.schema.yaml +2 -1
- data/examples/invoice/Makefile +5 -0
- data/examples/invoice/invoice.schema.yaml +3 -2
- data/examples/tapkit/Makefile +5 -0
- data/examples/tapkit/main.rb +7 -0
- data/examples/tapkit/tapkit.schema.yaml +6 -1
- data/lib/kwalify.rb +3 -3
- data/lib/kwalify/errors.rb +2 -2
- data/lib/kwalify/main.rb +161 -84
- data/lib/kwalify/messages.rb +17 -11
- data/lib/kwalify/meta-validator.rb +11 -2
- data/lib/kwalify/rule.rb +13 -3
- data/lib/kwalify/templates/genclass-java.eruby +195 -0
- data/lib/kwalify/templates/genclass-ruby.eruby +84 -0
- data/lib/kwalify/types.rb +18 -18
- data/lib/kwalify/util/assert-text-equal.rb +44 -0
- data/lib/kwalify/util/hash-interface.rb +37 -0
- data/lib/kwalify/util/option-parser.rb +2 -2
- data/lib/kwalify/util/testcase-helper.rb +112 -0
- data/lib/kwalify/util/yaml-helper.rb +2 -2
- data/lib/kwalify/validator.rb +2 -2
- data/lib/kwalify/yaml-parser.rb +12 -9
- data/test/test-main.rb +77 -78
- data/test/test-main.yaml +543 -769
- data/test/test-metavalidator.rb +27 -47
- data/test/test-metavalidator.yaml +21 -2
- data/test/test-rule.rb +6 -39
- data/test/test-rule.yaml +2 -2
- data/test/test-validator.rb +36 -869
- data/test/test-validator.yaml +28 -20
- data/test/test-yamlparser.rb +30 -1248
- data/test/test-yamlparser.yaml +138 -110
- data/test/test.rb +33 -13
- data/test/tmp.dir/Context.java +40 -0
- data/test/tmp.dir/Group.java +33 -0
- data/test/tmp.dir/User.java +43 -0
- data/test/tmp.dir/action1.document +18 -0
- data/test/tmp.dir/action1.schema +32 -0
- data/test/tmp.dir/action2.document +18 -0
- data/test/tmp.dir/action2.schema +32 -0
- data/test/tmp.dir/emacs.document +6 -0
- data/test/tmp.dir/emacs.schema +6 -0
- data/test/tmp.dir/meta1.document +0 -0
- data/test/tmp.dir/meta1.schema +3 -0
- data/test/tmp.dir/meta2.document +0 -0
- data/test/tmp.dir/meta2.schema +3 -0
- data/test/tmp.dir/silent1.document +3 -0
- data/test/tmp.dir/silent1.schema +3 -0
- data/test/tmp.dir/silent2.document +7 -0
- data/test/tmp.dir/silent2.schema +3 -0
- data/test/tmp.dir/stream.invalid +8 -0
- data/test/tmp.dir/stream.schema +3 -0
- data/test/tmp.dir/stream.valid +8 -0
- data/test/tmp.dir/untabify.document +5 -0
- data/test/tmp.dir/untabify.schema +10 -0
- metadata +98 -12
- data/lib/kwalify/util/assert-diff.rb +0 -44
data/test/test-yamlparser.yaml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 0.
|
2
|
+
## $Rev: 50 $
|
3
|
+
## $Release: 0.6.0 $
|
4
4
|
## copyright(c) 2005 kuwata-lab all rights reserved.
|
5
5
|
##
|
6
6
|
---
|
@@ -12,7 +12,7 @@ input: |
|
|
12
12
|
- ccc
|
13
13
|
expected: |
|
14
14
|
["aaa", "bbb", "ccc"]
|
15
|
-
|
15
|
+
##
|
16
16
|
---
|
17
17
|
name: sequence2
|
18
18
|
desc: nested sequence
|
@@ -77,7 +77,7 @@ expected: |
|
|
77
77
|
---
|
78
78
|
name: sequence6
|
79
79
|
desc: syntax error - invalid indent of sequence.
|
80
|
-
exception*: { ruby:
|
80
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
81
81
|
#
|
82
82
|
input: |
|
83
83
|
- AAA
|
@@ -90,7 +90,7 @@ expected: |
|
|
90
90
|
---
|
91
91
|
name: sequence7
|
92
92
|
desc: syntax error - sequence item is exepcted.
|
93
|
-
exception*: { ruby:
|
93
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
94
94
|
input: |
|
95
95
|
-
|
96
96
|
- a1
|
@@ -101,18 +101,17 @@ input: |
|
|
101
101
|
- b2
|
102
102
|
b3
|
103
103
|
expected: |
|
104
|
-
|
104
|
+
##
|
105
105
|
---
|
106
106
|
name: mapping1
|
107
107
|
desc: basic mapping
|
108
|
-
#
|
109
108
|
input: |
|
110
109
|
A: foo
|
111
110
|
B: bar
|
112
111
|
C : baz
|
113
|
-
#
|
114
112
|
expected: |
|
115
113
|
{"A"=>"foo", "B"=>"bar", "C"=>"baz"}
|
114
|
+
##
|
116
115
|
---
|
117
116
|
name: mapping2
|
118
117
|
desc: nested mapping
|
@@ -126,7 +125,7 @@ input: |
|
|
126
125
|
C: 30
|
127
126
|
expected: |
|
128
127
|
{"A"=>10, "B"=>{"B1"=>{"B1-1"=>21, "B1-2"=>22, "B1-3"=>23}}, "C"=>30}
|
129
|
-
|
128
|
+
##
|
130
129
|
---
|
131
130
|
name: mapping3
|
132
131
|
desc: null item in mapping
|
@@ -138,7 +137,7 @@ input: |
|
|
138
137
|
C:
|
139
138
|
expected: |
|
140
139
|
{"A"=>nil, "B"=>{"B1"=>{"B1-2"=>nil}}, "C"=>nil}
|
141
|
-
|
140
|
+
##
|
142
141
|
---
|
143
142
|
name: mapping4
|
144
143
|
desc: mapping with empty lines
|
@@ -156,14 +155,13 @@ input: |
|
|
156
155
|
B1a: 2
|
157
156
|
C: 3
|
158
157
|
|
159
|
-
#
|
160
158
|
expected: |
|
161
159
|
{"A"=>1, "B"=>{"B1"=>{"B1a"=>2}}, "C"=>3}
|
162
|
-
|
160
|
+
##
|
163
161
|
---
|
164
162
|
name: mapping5
|
165
163
|
desc: parse error - invalid indent of mapping.
|
166
|
-
exception*: { ruby:
|
164
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
167
165
|
input: |
|
168
166
|
A: 10
|
169
167
|
B: 20
|
@@ -171,11 +169,11 @@ input: |
|
|
171
169
|
B2: 22
|
172
170
|
C: 30
|
173
171
|
expected: |
|
174
|
-
|
172
|
+
##
|
175
173
|
---
|
176
174
|
name: mapping6
|
177
175
|
desc: parse error - mapping item is expected.
|
178
|
-
exception*: { ruby:
|
176
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
179
177
|
input: |
|
180
178
|
A:
|
181
179
|
a1: 1
|
@@ -186,7 +184,7 @@ input: |
|
|
186
184
|
b2: 2
|
187
185
|
b3 3
|
188
186
|
expected: |
|
189
|
-
|
187
|
+
##
|
190
188
|
---
|
191
189
|
name: combination1
|
192
190
|
desc: seq of mapping
|
@@ -201,7 +199,7 @@ input: |
|
|
201
199
|
#
|
202
200
|
expected: |
|
203
201
|
[{"x"=>10, "y"=>20}, {"x"=>15, "y"=>25}]
|
204
|
-
|
202
|
+
##
|
205
203
|
---
|
206
204
|
name: combination2
|
207
205
|
desc: seq of mapping (in same line)
|
@@ -214,7 +212,7 @@ input: |
|
|
214
212
|
#
|
215
213
|
expected: |
|
216
214
|
[{"x"=>10, "y"=>20}, {"x"=>15, "y"=>25}]
|
217
|
-
|
215
|
+
##
|
218
216
|
---
|
219
217
|
name: combination3
|
220
218
|
desc: seq of seq of seq
|
@@ -227,7 +225,7 @@ input: |
|
|
227
225
|
#
|
228
226
|
expected: |
|
229
227
|
[[["a", "b"]], [["c", "d"]]]
|
230
|
-
|
228
|
+
##
|
231
229
|
---
|
232
230
|
name: combination4
|
233
231
|
desc: map of sequence
|
@@ -244,7 +242,7 @@ input: |
|
|
244
242
|
#
|
245
243
|
expected: |
|
246
244
|
{"A"=>[1, 2, 3], "B"=>[4, 5, 6]}
|
247
|
-
|
245
|
+
##
|
248
246
|
---
|
249
247
|
name: combination5
|
250
248
|
desc: map of sequence (in same line)
|
@@ -259,6 +257,7 @@ input: |
|
|
259
257
|
#
|
260
258
|
expected: |
|
261
259
|
{"A"=>[1, 2, 3], "B"=>[4, 5, 6]}
|
260
|
+
##
|
262
261
|
---
|
263
262
|
name: combination6
|
264
263
|
desc: map of map of map
|
@@ -271,6 +270,7 @@ input: |
|
|
271
270
|
#
|
272
271
|
expected: |
|
273
272
|
{"A"=>{"a"=>{1=>100, 2=>200}}, "B"=>{"b"=>{3=>300, 4=>400}}}
|
273
|
+
##
|
274
274
|
---
|
275
275
|
name: comment1
|
276
276
|
desc: line comment
|
@@ -285,7 +285,7 @@ input: |
|
|
285
285
|
#
|
286
286
|
expected: |
|
287
287
|
["A", "B", ["C"]]
|
288
|
-
|
288
|
+
##
|
289
289
|
---
|
290
290
|
name: comment2
|
291
291
|
desc: escape line comment
|
@@ -336,7 +336,7 @@ input: |
|
|
336
336
|
#
|
337
337
|
expected: |
|
338
338
|
[[10, 20], [15, 25, 35]]
|
339
|
-
|
339
|
+
##
|
340
340
|
---
|
341
341
|
name: flowseq2
|
342
342
|
desc: nested flow style sequence
|
@@ -352,7 +352,7 @@ expected: |
|
|
352
352
|
# {1=>["A", ["B1", "B2"]],
|
353
353
|
# 2=>[[["X"]]],
|
354
354
|
# 3=>[["x1", "y1"], ["x2", "y2"], ["x3", "y3"]]}
|
355
|
-
|
355
|
+
##
|
356
356
|
---
|
357
357
|
name: flowseq3
|
358
358
|
desc: flow style sequence with some lines
|
@@ -370,12 +370,12 @@ input: |
|
|
370
370
|
#
|
371
371
|
expected: |
|
372
372
|
{"A"=>[[10, 20], [11, 21], [12, 22]], "B"=>[[1.1, 1.2, 1.3]]}
|
373
|
-
|
373
|
+
##
|
374
374
|
---
|
375
375
|
name: flowseq4
|
376
376
|
desc: invalid flow style seq (sequence item required (or last comma is extra).)
|
377
377
|
mesg: sequence item required (or last comma is extra).
|
378
|
-
exception*: { ruby:
|
378
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
379
379
|
#
|
380
380
|
input: |
|
381
381
|
A: [ [10,20], ]
|
@@ -386,7 +386,7 @@ expected: |
|
|
386
386
|
name: flowseq5
|
387
387
|
desc: invalid flow style seq (flow style sequence requires ']').
|
388
388
|
mesg: flow style sequence requires ']'
|
389
|
-
exception*: { ruby:
|
389
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
390
390
|
#
|
391
391
|
input: |
|
392
392
|
A: [ [10,20]
|
@@ -398,13 +398,13 @@ expected: |
|
|
398
398
|
name: flowseq6
|
399
399
|
desc: invalid flow style seq (flow style sequence requires ']').
|
400
400
|
mesg: flow style sequence is closed but got ']'.
|
401
|
-
exception*: { ruby:
|
401
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
402
402
|
#
|
403
403
|
input: |
|
404
404
|
[ 10 ]]
|
405
405
|
#
|
406
406
|
expected: |
|
407
|
-
|
407
|
+
##
|
408
408
|
---
|
409
409
|
name: flowmap1
|
410
410
|
desc: flow style map
|
@@ -426,7 +426,10 @@ input: |
|
|
426
426
|
#
|
427
427
|
expected: |
|
428
428
|
{"A"=>{"x"=>{"y"=>{"z"=>10}}}, "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
|
429
|
-
#
|
429
|
+
#expected: |
|
430
|
+
# {"A"=>{"x"=>{"y"=>{"z"=>10}}},
|
431
|
+
# "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
|
432
|
+
##
|
430
433
|
---
|
431
434
|
name: flowmap3
|
432
435
|
desc: flow style map with some lines
|
@@ -451,12 +454,15 @@ input: |
|
|
451
454
|
#
|
452
455
|
expected: |
|
453
456
|
{"A"=>{"x"=>{"y"=>{"z"=>10}}}, "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
|
454
|
-
#
|
457
|
+
#expected: |
|
458
|
+
# {"A"=>{"x"=>{"y"=>{"z"=>10}}},
|
459
|
+
# "B"=>{"a"=>1, "b"=>{"c"=>2, "d"=>3, "e"=>{"f"=>4}}, "g"=>5}}
|
460
|
+
##
|
455
461
|
---
|
456
462
|
name: flowmap4
|
457
463
|
desc: invalid flow style map (mapping item required (or last comma is extra).)
|
458
464
|
mesg: mapping item required (or last comma is extra).
|
459
|
-
exception*: { ruby:
|
465
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
460
466
|
#
|
461
467
|
input: |
|
462
468
|
- {A: 10, B: 20, }
|
@@ -467,7 +473,7 @@ expected: |
|
|
467
473
|
name: flowmap5
|
468
474
|
desc: invalid flow style map (flow style mapping requires '}').
|
469
475
|
mesg: flow style mapping requires '}'
|
470
|
-
exception*: { ruby:
|
476
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
471
477
|
#
|
472
478
|
input: |
|
473
479
|
- {A: { x: 10, y: 20 }
|
@@ -479,13 +485,13 @@ expected: |
|
|
479
485
|
name: flowmap6
|
480
486
|
desc: invalid flow style map (flow style mapping requires ']').
|
481
487
|
mesg: flow style mapping is closed but got '}'.
|
482
|
-
exception*: { ruby:
|
488
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
483
489
|
#
|
484
490
|
input: |
|
485
491
|
{ x: 10 }}
|
486
492
|
#
|
487
493
|
expected: |
|
488
|
-
|
494
|
+
##
|
489
495
|
---
|
490
496
|
name: flowcombination1
|
491
497
|
desc: combination of flow style seq and map
|
@@ -500,7 +506,7 @@ input: |
|
|
500
506
|
#
|
501
507
|
expected: |
|
502
508
|
[{"e-mail"=>"foo@mail.com", "name"=>" foo "}, {"e-mail"=>"ba__z@mail.com", "name"=>"ba z"}]
|
503
|
-
|
509
|
+
##
|
504
510
|
---
|
505
511
|
name: blocktext01
|
506
512
|
desc: parse_blocktext
|
@@ -525,7 +531,7 @@ input: |
|
|
525
531
|
#
|
526
532
|
expected: |
|
527
533
|
[{"text1"=>"foo\nbar\nbaz\n"}, {"text2"=>"aaa\n bbb\n ccc\n"}, "foo\nbar\nbaz\n", "aaa\n bbb\n ccc\n"]
|
528
|
-
|
534
|
+
##
|
529
535
|
---
|
530
536
|
name: blocktext02
|
531
537
|
desc: block text with '|+' or '|-'
|
@@ -555,37 +561,37 @@ input: |
|
|
555
561
|
#
|
556
562
|
expected: |
|
557
563
|
[{"text1"=>"A\n\nB\nC\n"}, {"text2"=>"A\n\nB\nC\n\n\n"}, {"text3"=>"A\n\nB\nC"}]
|
558
|
-
|
564
|
+
##
|
559
565
|
---
|
560
566
|
name: blocktext03
|
561
567
|
desc: block text with '|n'
|
562
568
|
#
|
563
569
|
input: |
|
564
|
-
- text1: |
|
565
|
-
|
570
|
+
- text1: |3
|
571
|
+
A
|
572
|
+
|
573
|
+
B
|
574
|
+
C
|
566
575
|
|
567
|
-
B
|
568
|
-
C
|
569
576
|
|
577
|
+
- text2: |+3
|
578
|
+
A
|
579
|
+
|
580
|
+
B
|
581
|
+
C
|
570
582
|
|
571
|
-
- text2: |+2
|
572
|
-
A
|
573
583
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
A
|
580
|
-
|
581
|
-
B
|
582
|
-
C
|
584
|
+
- text3: |-3
|
585
|
+
A
|
586
|
+
|
587
|
+
B
|
588
|
+
C
|
583
589
|
|
584
590
|
|
585
591
|
#
|
586
592
|
expected: |
|
587
593
|
[{"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"}]
|
588
|
-
|
594
|
+
##
|
589
595
|
---
|
590
596
|
name: blocktext04
|
591
597
|
desc: block text with '| foo'
|
@@ -604,7 +610,7 @@ input: |
|
|
604
610
|
#
|
605
611
|
expected: |
|
606
612
|
[{"text1"=>"foo A\n\nB\nC\n"}, "fooA\n B\n C\n"]
|
607
|
-
|
613
|
+
##
|
608
614
|
---
|
609
615
|
name: blocktext05
|
610
616
|
desc: block text with '#' (comment)
|
@@ -634,20 +640,20 @@ input: |
|
|
634
640
|
#
|
635
641
|
expected: |
|
636
642
|
[{"text1"=>"A\n#\nB\n", "text2"=>"#\n#\n"}, "A\n#\nB\n", "#\n#\n", "x"]
|
637
|
-
|
638
|
-
|
639
|
-
name: blocktext06
|
640
|
-
desc: invalid block text
|
641
|
-
exception*: { ruby:
|
642
|
-
|
643
|
-
input: |
|
644
|
-
- |
|
645
|
-
a
|
646
|
-
b
|
647
|
-
c
|
648
|
-
|
649
|
-
expected: |
|
650
|
-
|
643
|
+
##
|
644
|
+
#---
|
645
|
+
#name: blocktext06
|
646
|
+
#desc: invalid block text
|
647
|
+
#exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
648
|
+
##
|
649
|
+
#input: |
|
650
|
+
# - |
|
651
|
+
# a
|
652
|
+
# b
|
653
|
+
# c
|
654
|
+
##
|
655
|
+
#expected: |
|
656
|
+
###
|
651
657
|
---
|
652
658
|
name: blocktext11
|
653
659
|
desc: parse_blocktext (>)
|
@@ -672,7 +678,7 @@ input: |
|
|
672
678
|
#
|
673
679
|
expected: |
|
674
680
|
[{"text1"=>"foo bar baz\n"}, {"text2"=>"aaa bbb ccc\n"}, "foo bar baz\n", "aaa bbb ccc\n"]
|
675
|
-
|
681
|
+
##
|
676
682
|
---
|
677
683
|
name: blocktext12
|
678
684
|
desc: block text with '>+' or '>-'
|
@@ -702,7 +708,7 @@ input: |
|
|
702
708
|
#
|
703
709
|
expected: |
|
704
710
|
[{"text1"=>"A\nB C\n"}, {"text2"=>"A\nB C\n\n\n"}, {"text3"=>"A\nB C"}]
|
705
|
-
|
711
|
+
##
|
706
712
|
---
|
707
713
|
name: blocktext13
|
708
714
|
desc: block text with '>n'
|
@@ -783,19 +789,19 @@ input: |
|
|
783
789
|
expected: |
|
784
790
|
[{"text1"=>"AA ## BB\n", "text2"=>"# #\n"}, "AA ## BB\n", "# #\n", "x"]
|
785
791
|
#
|
786
|
-
|
787
|
-
name: blocktext16
|
788
|
-
desc: invalid block text
|
789
|
-
exception*: { ruby:
|
790
|
-
|
791
|
-
input: |
|
792
|
-
- >
|
793
|
-
a
|
794
|
-
b
|
795
|
-
c
|
796
|
-
|
797
|
-
expected: |
|
798
|
-
|
792
|
+
#---
|
793
|
+
#name: blocktext16
|
794
|
+
#desc: invalid block text
|
795
|
+
#exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
796
|
+
##
|
797
|
+
#input: |
|
798
|
+
# - >
|
799
|
+
# a
|
800
|
+
# b
|
801
|
+
# c
|
802
|
+
##
|
803
|
+
#expected: |
|
804
|
+
###
|
799
805
|
---
|
800
806
|
name: anchor1
|
801
807
|
desc: parse_anchor, parse_alias
|
@@ -827,6 +833,7 @@ expected: |
|
|
827
833
|
---
|
828
834
|
name: anchor3
|
829
835
|
desc: anchor on child node
|
836
|
+
recursive: yes
|
830
837
|
#
|
831
838
|
input: |
|
832
839
|
- A: &a1
|
@@ -836,7 +843,7 @@ input: |
|
|
836
843
|
#
|
837
844
|
expected: |
|
838
845
|
[{"A"=>{"x"=>10, "y"=>20, "z"=>{...}}}]
|
839
|
-
|
846
|
+
##
|
840
847
|
---
|
841
848
|
name: anchor4
|
842
849
|
desc: backward anchor
|
@@ -849,12 +856,12 @@ input: |
|
|
849
856
|
#
|
850
857
|
expected: |
|
851
858
|
["bar", "bar", "foo", "bar"]
|
852
|
-
|
859
|
+
##
|
853
860
|
---
|
854
861
|
name: anchor5
|
855
862
|
desc: anchor not found
|
856
|
-
exception*: { ruby:
|
857
|
-
mesg: anchor 'a2' not found (
|
863
|
+
exception*: { ruby: YamlSyntaxError, java: kwalify.SyntaxException }
|
864
|
+
mesg: anchor 'a2' not found (YamlSyntaxError)
|
858
865
|
#
|
859
866
|
input: |
|
860
867
|
- &a1 foo
|
@@ -862,10 +869,11 @@ input: |
|
|
862
869
|
- *a2
|
863
870
|
#
|
864
871
|
expected: |
|
865
|
-
|
872
|
+
##
|
866
873
|
---
|
867
874
|
name: anchor6
|
868
875
|
desc: anchor on child node
|
876
|
+
recursive: yes
|
869
877
|
#
|
870
878
|
input: |
|
871
879
|
type: seq
|
@@ -894,7 +902,7 @@ expected*:
|
|
894
902
|
"type"=>"seq"}
|
895
903
|
java: |
|
896
904
|
{"sequence"=>[{"mapping"=>{"name"=>{"type"=>"str"}, "post"=>{"enum"=>["exective", "manager", "clerk"], "type"=>"str"}, "supervisor"=>{...}}, "type"=>"map"}], "type"=>"seq"}
|
897
|
-
|
905
|
+
##
|
898
906
|
---
|
899
907
|
name: tag1
|
900
908
|
desc: tag
|
@@ -905,7 +913,7 @@ input: |
|
|
905
913
|
#
|
906
914
|
expected: |
|
907
915
|
[123, {"foo"=>123}]
|
908
|
-
|
916
|
+
##
|
909
917
|
---
|
910
918
|
name: docend1
|
911
919
|
desc: ... (document end)
|
@@ -931,7 +939,7 @@ input: |
|
|
931
939
|
#
|
932
940
|
expected: |
|
933
941
|
["foo\n...\nbar\n"]
|
934
|
-
|
942
|
+
##
|
935
943
|
---
|
936
944
|
name: docstart1
|
937
945
|
desc: --- (document start)
|
@@ -944,7 +952,7 @@ input: |
|
|
944
952
|
#
|
945
953
|
expected: |
|
946
954
|
["foo", "bar"]
|
947
|
-
|
955
|
+
##
|
948
956
|
---
|
949
957
|
name: docstart2
|
950
958
|
desc: --- (document start) with tag
|
@@ -957,7 +965,7 @@ input: |
|
|
957
965
|
#
|
958
966
|
expected: |
|
959
967
|
["foo", "bar"]
|
960
|
-
|
968
|
+
##
|
961
969
|
---
|
962
970
|
name: docstart3
|
963
971
|
desc: --- (document start) with tag
|
@@ -972,7 +980,7 @@ input: |
|
|
972
980
|
#
|
973
981
|
expected: |
|
974
982
|
["foo\n---\nbar\n---\nbaz\n"]
|
975
|
-
|
983
|
+
##
|
976
984
|
---
|
977
985
|
name: default1
|
978
986
|
desc: map default value
|
@@ -990,7 +998,7 @@ input: |
|
|
990
998
|
#
|
991
999
|
expected: |
|
992
1000
|
[{"A"=>10, "B"=>20}, {"K"=>{"x"=>10, "y"=>20}}]
|
993
|
-
|
1001
|
+
##
|
994
1002
|
---
|
995
1003
|
name: merge1
|
996
1004
|
desc: merge key '<<'
|
@@ -1005,6 +1013,7 @@ input: |
|
|
1005
1013
|
#
|
1006
1014
|
expected: |
|
1007
1015
|
[{"A"=>10, "B"=>20}, {"A"=>nil, "B"=>20, "C"=>30}]
|
1016
|
+
##
|
1008
1017
|
---
|
1009
1018
|
name: scalar1
|
1010
1019
|
desc: scalar with sequence
|
@@ -1024,26 +1033,29 @@ input: |
|
|
1024
1033
|
- :sym
|
1025
1034
|
expected*:
|
1026
1035
|
ruby: |
|
1027
|
-
["abc",
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
true,
|
1033
|
-
false,
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1036
|
+
["abc", 123, 3.14, true, false, true, false, nil, nil, "123", "456", #<Date: 4906743/2,0,2299161>, :sym]
|
1037
|
+
# ruby: |
|
1038
|
+
# ["abc",
|
1039
|
+
# 123,
|
1040
|
+
# 3.14,
|
1041
|
+
# true,
|
1042
|
+
# false,
|
1043
|
+
# true,
|
1044
|
+
# false,
|
1045
|
+
# nil,
|
1046
|
+
# nil,
|
1047
|
+
# "123",
|
1048
|
+
# "456",
|
1049
|
+
# #<Date: 4906743/2,0,2299161>,
|
1050
|
+
# :sym]
|
1040
1051
|
java: |
|
1041
1052
|
["abc", 123, 3.14, true, false, true, false, nil, nil, "123", "456", Tue Feb 01 00:00:00 JST 2005, ":sym"]
|
1042
1053
|
# ["abc", 123, true, false, true, false, nil, nil, "123", "456", #<Date: 4906743/2,0,2299161>, :sym]
|
1043
|
-
|
1054
|
+
##
|
1044
1055
|
---
|
1045
1056
|
name: scalar2
|
1046
1057
|
desc: mapping of scalar
|
1058
|
+
pp: yes
|
1047
1059
|
input: |
|
1048
1060
|
- abc : ABC
|
1049
1061
|
- 123 : 123
|
@@ -1052,12 +1064,13 @@ input: |
|
|
1052
1064
|
- false : false
|
1053
1065
|
- yes : yes
|
1054
1066
|
- no : no
|
1055
|
-
-
|
1067
|
+
- null : ~
|
1056
1068
|
- null : null
|
1057
1069
|
- "123" : "123"
|
1058
1070
|
- '456' : '456'
|
1059
1071
|
- 2005-01-01 : 2005-01-01
|
1060
1072
|
- :sym : :sym
|
1073
|
+
# - ~ : ~
|
1061
1074
|
expected*:
|
1062
1075
|
ruby: |
|
1063
1076
|
[{"abc"=>"ABC"},
|
@@ -1078,3 +1091,18 @@ expected*:
|
|
1078
1091
|
# {123=>1.23, 3.14=>314, "abc"=>"ABC"}
|
1079
1092
|
# {"abc"=>"ABC", 3.14=>314, 123=>1.23}
|
1080
1093
|
|
1094
|
+
##
|
1095
|
+
---
|
1096
|
+
name: mapkey1
|
1097
|
+
desc: mapping key test
|
1098
|
+
input: |
|
1099
|
+
- key1: A
|
1100
|
+
- .key.2: B
|
1101
|
+
- key3*: C
|
1102
|
+
- :key4: D
|
1103
|
+
# - k:e:y:5: E
|
1104
|
+
expected*:
|
1105
|
+
ruby: |
|
1106
|
+
[{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}]
|
1107
|
+
# [{"key1"=>"A"}, {".key.2"=>"B"}, {"key3*"=>"C"}, {:key4=>"D"}, {"k:e:y:5"=>"E"}]
|
1108
|
+
java: |
|