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