| 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 |
- decode: |
| 34 |
name: string value in map[string]string |
| 35 |
yaml: 'v: hi' |
| 36 |
type: map[string]string |
| 37 |
want: |
| 38 |
v: hi |
| 39 |
|
| 40 |
- decode: |
| 41 |
name: string value in map[string]any |
| 42 |
yaml: 'v: hi' |
| 43 |
type: map[string]any |
| 44 |
want: |
| 45 |
v: hi |
| 46 |
|
| 47 |
- decode: |
| 48 |
name: true as string in map[string]string |
| 49 |
yaml: 'v: true' |
| 50 |
type: map[string]string |
| 51 |
want: |
| 52 |
v: 'true' |
| 53 |
|
| 54 |
- decode: |
| 55 |
name: true as bool in map[string]any |
| 56 |
yaml: 'v: true' |
| 57 |
type: map[string]any |
| 58 |
want: |
| 59 |
v: true |
| 60 |
|
| 61 |
- decode: |
| 62 |
name: integer in map[string]any |
| 63 |
yaml: 'v: 10' |
| 64 |
type: map[string]any |
| 65 |
want: |
| 66 |
v: 10 |
| 67 |
|
| 68 |
- decode: |
| 69 |
name: binary integer in map[string]any |
| 70 |
yaml: 'v: 0b10' |
| 71 |
type: map[string]any |
| 72 |
want: |
| 73 |
v: 2 |
| 74 |
|
| 75 |
- decode: |
| 76 |
name: hex integer in map[string]any |
| 77 |
yaml: 'v: 0xA' |
| 78 |
type: map[string]any |
| 79 |
want: |
| 80 |
v: 10 |
| 81 |
|
| 82 |
- decode: |
| 83 |
name: large integer in map[string]int64 |
| 84 |
yaml: 'v: 4294967296' |
| 85 |
type: map[string]int64 |
| 86 |
want: |
| 87 |
v: 4294967296 |
| 88 |
|
| 89 |
- decode: |
| 90 |
name: float in map[string]any |
| 91 |
yaml: 'v: 0.1' |
| 92 |
type: map[string]any |
| 93 |
want: |
| 94 |
v: 0.1 |
| 95 |
|
| 96 |
- decode: |
| 97 |
name: float with leading dot in map[string]any |
| 98 |
yaml: 'v: .1' |
| 99 |
type: map[string]any |
| 100 |
want: |
| 101 |
v: 0.1 |
| 102 |
|
| 103 |
- decode: |
| 104 |
name: positive infinity in map[string]any |
| 105 |
yaml: 'v: .Inf' |
| 106 |
type: map[string]any |
| 107 |
want: |
| 108 |
v: '+Inf' |
| 109 |
|
| 110 |
- decode: |
| 111 |
name: negative infinity in map[string]any |
| 112 |
yaml: 'v: -.Inf' |
| 113 |
type: map[string]any |
| 114 |
want: |
| 115 |
v: '-Inf' |
| 116 |
|
| 117 |
- decode: |
| 118 |
name: negative integer in map[string]any |
| 119 |
yaml: 'v: -10' |
| 120 |
type: map[string]any |
| 121 |
want: |
| 122 |
v: -10 |
| 123 |
|
| 124 |
- decode: |
| 125 |
name: negative float in map[string]any |
| 126 |
yaml: 'v: -.1' |
| 127 |
type: map[string]any |
| 128 |
want: |
| 129 |
v: -0.1 |
| 130 |
|
| 131 |
- decode: |
| 132 |
name: negative zero in map[string]any |
| 133 |
yaml: 'v: -0' |
| 134 |
type: map[string]any |
| 135 |
want: |
| 136 |
v: '-0' |
| 137 |
|
| 138 |
- decode: |
| 139 |
name: escaped newlines in map[string]string |
| 140 |
yaml: | |
| 141 |
a: "\t\n\t\n" |
| 142 |
type: map[string]string |
| 143 |
want: |
| 144 |
a: "\t\n\t\n" |
| 145 |
|
| 146 |
- decode: |
| 147 |
name: merge key as regular key |
| 148 |
yaml: | |
| 149 |
"<<": [] |
| 150 |
type: map[string]any |
| 151 |
want: |
| 152 |
'<<': [] |
| 153 |
|
| 154 |
- decode: |
| 155 |
name: merge key value as string |
| 156 |
yaml: | |
| 157 |
foo: "<<" |
| 158 |
type: map[string]any |
| 159 |
want: |
| 160 |
foo: '<<' |
| 161 |
|
| 162 |
- decode: |
| 163 |
name: canonical float |
| 164 |
yaml: 'canonical: 6.8523e+5' |
| 165 |
type: map[string]any |
| 166 |
want: |
| 167 |
canonical: 6.8523e+5 |
| 168 |
|
| 169 |
- decode: |
| 170 |
name: exponential float with underscores |
| 171 |
yaml: 'expo: 685.230_15e+03' |
| 172 |
type: map[string]any |
| 173 |
want: |
| 174 |
expo: 685.23015e+03 |
| 175 |
|
| 176 |
- decode: |
| 177 |
name: fixed float with underscores |
| 178 |
yaml: 'fixed: 685_230.15' |
| 179 |
type: map[string]any |
| 180 |
want: |
| 181 |
fixed: 685230.15 |
| 182 |
|
| 183 |
- decode: |
| 184 |
name: negative infinity |
| 185 |
yaml: 'neginf: -.inf' |
| 186 |
type: map[string]any |
| 187 |
want: |
| 188 |
neginf: '-Inf' |
| 189 |
|
| 190 |
- decode: |
| 191 |
name: fixed float in map[string]float64 |
| 192 |
yaml: 'fixed: 685_230.15' |
| 193 |
type: map[string]float64 |
| 194 |
want: |
| 195 |
fixed: 685230.15 |
| 196 |
|
| 197 |
|
| 198 |
- decode: |
| 199 |
name: canonical true |
| 200 |
yaml: 'canonical: true' |
| 201 |
type: map[string]any |
| 202 |
want: |
| 203 |
canonical: true |
| 204 |
|
| 205 |
- decode: |
| 206 |
name: canonical false |
| 207 |
yaml: 'canonical: false' |
| 208 |
type: map[string]any |
| 209 |
want: |
| 210 |
canonical: false |
| 211 |
|
| 212 |
- decode: |
| 213 |
name: True with capital T |
| 214 |
yaml: 'bool: True' |
| 215 |
type: map[string]any |
| 216 |
want: |
| 217 |
bool: true |
| 218 |
|
| 219 |
- decode: |
| 220 |
name: False with capital F |
| 221 |
yaml: 'bool: False' |
| 222 |
type: map[string]any |
| 223 |
want: |
| 224 |
bool: false |
| 225 |
|
| 226 |
- decode: |
| 227 |
name: TRUE all caps |
| 228 |
yaml: 'bool: TRUE' |
| 229 |
type: map[string]any |
| 230 |
want: |
| 231 |
bool: true |
| 232 |
|
| 233 |
- decode: |
| 234 |
name: FALSE all caps |
| 235 |
yaml: 'bool: FALSE' |
| 236 |
type: map[string]any |
| 237 |
want: |
| 238 |
bool: false |
| 239 |
|
| 240 |
|
| 241 |
- decode: |
| 242 |
name: on as bool (1.1 compat) |
| 243 |
yaml: 'option: on' |
| 244 |
type: map[string]bool |
| 245 |
want: |
| 246 |
option: true |
| 247 |
|
| 248 |
- decode: |
| 249 |
name: y as bool (1.1 compat) |
| 250 |
yaml: 'option: y' |
| 251 |
type: map[string]bool |
| 252 |
want: |
| 253 |
option: true |
| 254 |
|
| 255 |
- decode: |
| 256 |
name: Off as bool (1.1 compat) |
| 257 |
yaml: 'option: Off' |
| 258 |
type: map[string]bool |
| 259 |
want: |
| 260 |
option: false |
| 261 |
|
| 262 |
- decode: |
| 263 |
name: No as bool (1.1 compat) |
| 264 |
yaml: 'option: No' |
| 265 |
type: map[string]bool |
| 266 |
want: |
| 267 |
option: false |
| 268 |
|
| 269 |
- decode: |
| 270 |
name: non-bool string ignored in bool map |
| 271 |
yaml: 'option: other' |
| 272 |
type: map[string]bool |
| 273 |
want: {} |
| 274 |
|
| 275 |
|
| 276 |
- decode: |
| 277 |
name: canonical integer |
| 278 |
yaml: 'canonical: 685230' |
| 279 |
type: map[string]any |
| 280 |
want: |
| 281 |
canonical: 685230 |
| 282 |
|
| 283 |
- decode: |
| 284 |
name: decimal with underscores and plus |
| 285 |
yaml: 'decimal: +685_230' |
| 286 |
type: map[string]any |
| 287 |
want: |
| 288 |
decimal: 685230 |
| 289 |
|
| 290 |
- decode: |
| 291 |
name: octal with leading zero |
| 292 |
yaml: 'octal: 02472256' |
| 293 |
type: map[string]any |
| 294 |
want: |
| 295 |
octal: 685230 |
| 296 |
|
| 297 |
- decode: |
| 298 |
name: negative octal with leading zero |
| 299 |
yaml: 'octal: -02472256' |
| 300 |
type: map[string]any |
| 301 |
want: |
| 302 |
octal: -685230 |
| 303 |
|
| 304 |
- decode: |
| 305 |
name: octal with 0o prefix |
| 306 |
yaml: 'octal: 0o2472256' |
| 307 |
type: map[string]any |
| 308 |
want: |
| 309 |
octal: 685230 |
| 310 |
|
| 311 |
- decode: |
| 312 |
name: negative octal with 0o prefix |
| 313 |
yaml: 'octal: -0o2472256' |
| 314 |
type: map[string]any |
| 315 |
want: |
| 316 |
octal: -685230 |
| 317 |
|
| 318 |
- decode: |
| 319 |
name: hex with underscores |
| 320 |
yaml: 'hexa: 0x_0A_74_AE' |
| 321 |
type: map[string]any |
| 322 |
want: |
| 323 |
hexa: 685230 |
| 324 |
|
| 325 |
- decode: |
| 326 |
name: binary with underscores |
| 327 |
yaml: 'bin: 0b1010_0111_0100_1010_1110' |
| 328 |
type: map[string]any |
| 329 |
want: |
| 330 |
bin: 685230 |
| 331 |
|
| 332 |
- decode: |
| 333 |
name: negative binary |
| 334 |
yaml: 'bin: -0b101010' |
| 335 |
type: map[string]any |
| 336 |
want: |
| 337 |
bin: -42 |
| 338 |
|
| 339 |
- decode: |
| 340 |
name: binary MinInt64 |
| 341 |
yaml: 'bin: -0b1000000000000000000000000000000000000000000000000000000000000000' |
| 342 |
type: map[string]any |
| 343 |
want: |
| 344 |
bin: MinInt64 |
| 345 |
|
| 346 |
- decode: |
| 347 |
name: decimal in map[string]int |
| 348 |
yaml: 'decimal: +685_230' |
| 349 |
type: map[string]int |
| 350 |
want: |
| 351 |
decimal: 685230 |
| 352 |
|
| 353 |
|
| 354 |
- decode: |
| 355 |
name: empty value as null |
| 356 |
yaml: 'empty:' |
| 357 |
type: map[string]any |
| 358 |
want: |
| 359 |
empty: null |
| 360 |
|
| 361 |
- decode: |
| 362 |
name: tilde as null |
| 363 |
yaml: 'canonical: ~' |
| 364 |
type: map[string]any |
| 365 |
want: |
| 366 |
canonical: null |
| 367 |
|
| 368 |
- decode: |
| 369 |
name: null keyword |
| 370 |
yaml: 'english: null' |
| 371 |
type: map[string]any |
| 372 |
want: |
| 373 |
english: null |
| 374 |
|
| 375 |
|
| 376 |
- decode: |
| 377 |
name: flow sequence two items |
| 378 |
yaml: 'seq: [A,B]' |
| 379 |
type: map[string]any |
| 380 |
want: |
| 381 |
seq: [A, B] |
| 382 |
|
| 383 |
- decode: |
| 384 |
name: flow sequence with trailing comma |
| 385 |
yaml: 'seq: [A,B,C,]' |
| 386 |
type: map[string][]string |
| 387 |
want: |
| 388 |
seq: [A, B, C] |
| 389 |
|
| 390 |
- decode: |
| 391 |
name: flow sequence mixed types to string slice |
| 392 |
yaml: 'seq: [A,1,C]' |
| 393 |
type: map[string][]string |
| 394 |
want: |
| 395 |
seq: [A, '1', C] |
| 396 |
|
| 397 |
- decode: |
| 398 |
name: flow sequence mixed types to int slice |
| 399 |
yaml: 'seq: [A,1,C]' |
| 400 |
type: map[string][]int |
| 401 |
want: |
| 402 |
seq: [1] |
| 403 |
|
| 404 |
- decode: |
| 405 |
name: flow sequence mixed types |
| 406 |
yaml: 'seq: [A,1,C]' |
| 407 |
type: map[string]any |
| 408 |
want: |
| 409 |
seq: [A, 1, C] |
| 410 |
|
| 411 |
- decode: |
| 412 |
name: flow sequence with colon prefixed strings |
| 413 |
yaml: 'seq: [:A,1,:C]' |
| 414 |
type: map[string]any |
| 415 |
want: |
| 416 |
seq: [':A', 1, ':C'] |
| 417 |
|
| 418 |
- decode: |
| 419 |
name: flow sequence with inline map |
| 420 |
yaml: 'seq: [:: A,1,:C]' |
| 421 |
type: map[string]any |
| 422 |
want: |
| 423 |
seq: |
| 424 |
- ':': A |
| 425 |
- 1 |
| 426 |
- ':C' |
| 427 |
|
| 428 |
|
| 429 |
- decode: |
| 430 |
name: block sequence two items |
| 431 |
yaml: | |
| 432 |
seq: |
| 433 |
- A |
| 434 |
- B |
| 435 |
type: map[string]any |
| 436 |
want: |
| 437 |
seq: [A, B] |
| 438 |
|
| 439 |
- decode: |
| 440 |
name: block sequence to string slice |
| 441 |
yaml: | |
| 442 |
seq: |
| 443 |
- A |
| 444 |
- B |
| 445 |
- C |
| 446 |
type: map[string][]string |
| 447 |
want: |
| 448 |
seq: [A, B, C] |
| 449 |
|
| 450 |
- decode: |
| 451 |
name: block sequence mixed types to string slice |
| 452 |
yaml: | |
| 453 |
seq: |
| 454 |
- A |
| 455 |
- 1 |
| 456 |
- C |
| 457 |
type: map[string][]string |
| 458 |
want: |
| 459 |
seq: [A, '1', C] |
| 460 |
|
| 461 |
- decode: |
| 462 |
name: block sequence mixed types to int slice |
| 463 |
yaml: | |
| 464 |
seq: |
| 465 |
- A |
| 466 |
- 1 |
| 467 |
- C |
| 468 |
type: map[string][]int |
| 469 |
want: |
| 470 |
seq: [1] |
| 471 |
|
| 472 |
- decode: |
| 473 |
name: block sequence mixed types |
| 474 |
yaml: | |
| 475 |
seq: |
| 476 |
- A |
| 477 |
- 1 |
| 478 |
- C |
| 479 |
type: map[string]any |
| 480 |
want: |
| 481 |
seq: [A, 1, C] |
| 482 |
|
| 483 |
|
| 484 |
- decode: |
| 485 |
name: literal scalar |
| 486 |
yaml: | |
| 487 |
scalar: | # Comment |
| 488 |
|
| 489 |
literal |
| 490 |
|
| 491 |
text |
| 492 |
|
| 493 |
type: map[string]string |
| 494 |
want: |
| 495 |
scalar: "\nliteral\n\n\ttext\n" |
| 496 |
|
| 497 |
- decode: |
| 498 |
name: folded scalar |
| 499 |
yaml: | |
| 500 |
scalar: > # Comment |
| 501 |
|
| 502 |
folded |
| 503 |
line |
| 504 |
|
| 505 |
next |
| 506 |
line |
| 507 |
* one |
| 508 |
* two |
| 509 |
|
| 510 |
last |
| 511 |
line |
| 512 |
|
| 513 |
type: map[string]string |
| 514 |
want: |
| 515 |
scalar: "\nfolded line\nnext line\n * one\n * two\n\nlast line\n" |
| 516 |
|
| 517 |
|
| 518 |
- decode: |
| 519 |
name: nested map |
| 520 |
yaml: 'a: {b: c}' |
| 521 |
type: map[any]any |
| 522 |
want: |
| 523 |
a: |
| 524 |
b: c |
| 525 |
|
| 526 |
|
| 527 |
- decode: |
| 528 |
name: quoted strings as keys and values |
| 529 |
yaml: '''1'': ''"2"''' |
| 530 |
type: map[any]any |
| 531 |
want: |
| 532 |
'1': '"2"' |
| 533 |
|
| 534 |
- decode: |
| 535 |
name: multiline quoted string in sequence |
| 536 |
yaml: | |
| 537 |
v: |
| 538 |
- A |
| 539 |
- 'B |
| 540 |
|
| 541 |
C' |
| 542 |
type: map[string][]string |
| 543 |
want: |
| 544 |
v: [A, "B\nC"] |
| 545 |
|
| 546 |
|
| 547 |
- decode: |
| 548 |
name: unsigned int |
| 549 |
yaml: 'v: 42' |
| 550 |
type: map[string]uint |
| 551 |
want: |
| 552 |
v: 42 |
| 553 |
|
| 554 |
- decode: |
| 555 |
name: negative to uint fails |
| 556 |
yaml: 'v: -42' |
| 557 |
type: map[string]uint |
| 558 |
want: {} |
| 559 |
|
| 560 |
- decode: |
| 561 |
name: large uint64 |
| 562 |
yaml: 'v: 4294967296' |
| 563 |
type: map[string]uint64 |
| 564 |
want: |
| 565 |
v: 4294967296 |
| 566 |
|
| 567 |
- decode: |
| 568 |
name: negative to uint64 fails |
| 569 |
yaml: 'v: -4294967296' |
| 570 |
type: map[string]uint64 |
| 571 |
want: {} |
| 572 |
|
| 573 |
|
| 574 |
- decode: |
| 575 |
name: MaxInt32 |
| 576 |
yaml: 'int_max: 2147483647' |
| 577 |
type: map[string]int |
| 578 |
want: |
| 579 |
int_max: MaxInt32 |
| 580 |
|
| 581 |
- decode: |
| 582 |
name: MinInt32 |
| 583 |
yaml: 'int_min: -2147483648' |
| 584 |
type: map[string]int |
| 585 |
want: |
| 586 |
int_min: MinInt32 |
| 587 |
|
| 588 |
- decode: |
| 589 |
name: int overflow MaxInt64+1 |
| 590 |
yaml: 'int_overflow: 9223372036854775808' |
| 591 |
type: map[string]int |
| 592 |
want: {} |
| 593 |
|
| 594 |
|
| 595 |
- decode: |
| 596 |
name: MaxInt64 |
| 597 |
yaml: 'int64_max: 9223372036854775807' |
| 598 |
type: map[string]int64 |
| 599 |
want: |
| 600 |
int64_max: MaxInt64 |
| 601 |
|
| 602 |
- decode: |
| 603 |
name: MaxInt64 in binary |
| 604 |
yaml: 'int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111' |
| 605 |
type: map[string]int64 |
| 606 |
want: |
| 607 |
int64_max_base2: MaxInt64 |
| 608 |
|
| 609 |
- decode: |
| 610 |
name: MinInt64 |
| 611 |
yaml: 'int64_min: -9223372036854775808' |
| 612 |
type: map[string]int64 |
| 613 |
want: |
| 614 |
int64_min: MinInt64 |
| 615 |
|
| 616 |
- decode: |
| 617 |
name: negative MaxInt64 in binary |
| 618 |
yaml: 'int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111' |
| 619 |
type: map[string]int64 |
| 620 |
want: |
| 621 |
int64_neg_base2: -9223372036854775807 |
| 622 |
|
| 623 |
- decode: |
| 624 |
name: int64 overflow MaxInt64+1 |
| 625 |
yaml: 'int64_overflow: 9223372036854775808' |
| 626 |
type: map[string]int64 |
| 627 |
want: {} |
| 628 |
|
| 629 |
|
| 630 |
- decode: |
| 631 |
name: uint min |
| 632 |
yaml: 'uint_min: 0' |
| 633 |
type: map[string]uint |
| 634 |
want: |
| 635 |
uint_min: 0 |
| 636 |
|
| 637 |
- decode: |
| 638 |
name: MaxUint32 |
| 639 |
yaml: 'uint_max: 4294967295' |
| 640 |
type: map[string]uint |
| 641 |
want: |
| 642 |
uint_max: MaxUint32 |
| 643 |
|
| 644 |
- decode: |
| 645 |
name: uint underflow |
| 646 |
yaml: 'uint_underflow: -1' |
| 647 |
type: map[string]uint |
| 648 |
want: {} |
| 649 |
|
| 650 |
- decode: |
| 651 |
name: uint64 min |
| 652 |
yaml: 'uint64_min: 0' |
| 653 |
type: map[string]uint |
| 654 |
want: |
| 655 |
uint64_min: 0 |
| 656 |
|
| 657 |
- decode: |
| 658 |
name: MaxUint64 |
| 659 |
yaml: 'uint64_max: 18446744073709551615' |
| 660 |
type: map[string]uint64 |
| 661 |
want: |
| 662 |
uint64_max: MaxUint64 |
| 663 |
|
| 664 |
- decode: |
| 665 |
name: MaxUint64 in binary |
| 666 |
yaml: 'uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111' |
| 667 |
type: map[string]uint64 |
| 668 |
want: |
| 669 |
uint64_max_base2: MaxUint64 |
| 670 |
|
| 671 |
- decode: |
| 672 |
name: MaxInt64 as uint64 |
| 673 |
yaml: 'uint64_maxint64: 9223372036854775807' |
| 674 |
type: map[string]uint64 |
| 675 |
want: |
| 676 |
uint64_maxint64: MaxInt64 |
| 677 |
|
| 678 |
- decode: |
| 679 |
name: uint64 underflow |
| 680 |
yaml: 'uint64_underflow: -1' |
| 681 |
type: map[string]uint64 |
| 682 |
want: {} |
| 683 |
|
| 684 |
|
| 685 |
- decode: |
| 686 |
name: MaxFloat32 |
| 687 |
yaml: 'float32_max: 3.40282346638528859811704183484516925440e+38' |
| 688 |
type: map[string]float32 |
| 689 |
want: |
| 690 |
float32_max: 3.4028235e+38 |
| 691 |
|
| 692 |
- decode: |
| 693 |
name: MaxUint64 as float32 |
| 694 |
yaml: 'float32_maxuint64: 18446744073709551615' |
| 695 |
type: map[string]float32 |
| 696 |
want: |
| 697 |
float32_maxuint64: 1.8446744e+19 |
| 698 |
|
| 699 |
- decode: |
| 700 |
name: MaxUint64+1 as float32 |
| 701 |
yaml: 'float32_maxuint64+1: 18446744073709551616' |
| 702 |
type: map[string]float32 |
| 703 |
want: |
| 704 |
float32_maxuint64+1: 1.8446744e+19 |
| 705 |
|
| 706 |
|
| 707 |
- decode: |
| 708 |
name: MaxFloat64 |
| 709 |
yaml: 'float64_max: 1.797693134862315708145274237317043567981e+308' |
| 710 |
type: map[string]float64 |
| 711 |
want: |
| 712 |
float64_max: MaxFloat64 |
| 713 |
|
| 714 |
- decode: |
| 715 |
name: SmallestNonzeroFloat64 |
| 716 |
yaml: 'float64_nonzero: 4.940656458412465441765687928682213723651e-324' |
| 717 |
type: map[string]float64 |
| 718 |
want: |
| 719 |
float64_nonzero: SmallestNonzeroFloat64 |
| 720 |
|
| 721 |
- decode: |
| 722 |
name: MaxUint64 as float64 |
| 723 |
yaml: 'float64_maxuint64: 18446744073709551615' |
| 724 |
type: map[string]float64 |
| 725 |
want: |
| 726 |
float64_maxuint64: 1.8446744073709552e+19 |
| 727 |
|
| 728 |
- decode: |
| 729 |
name: MaxUint64+1 as float64 |
| 730 |
yaml: 'float64_maxuint64+1: 18446744073709551616' |
| 731 |
type: map[string]float64 |
| 732 |
want: |
| 733 |
float64_maxuint64+1: 1.8446744073709552e+19 |
| 734 |
|
| 735 |
|
| 736 |
- decode: |
| 737 |
name: int32 overflow |
| 738 |
yaml: 'v: 4294967297' |
| 739 |
type: map[string]int32 |
| 740 |
want: {} |
| 741 |
|
| 742 |
- decode: |
| 743 |
name: int8 overflow |
| 744 |
yaml: 'v: 128' |
| 745 |
type: map[string]int8 |
| 746 |
want: {} |
| 747 |
|
| 748 |
|
| 749 |
- decode: |
| 750 |
name: explicit float tag on string |
| 751 |
yaml: "v: !!float '1.1'" |
| 752 |
type: map[string]any |
| 753 |
want: |
| 754 |
v: 1.1 |
| 755 |
|
| 756 |
- decode: |
| 757 |
name: explicit float tag on zero |
| 758 |
yaml: 'v: !!float 0' |
| 759 |
type: map[string]any |
| 760 |
want: |
| 761 |
v: 0.0 |
| 762 |
|
| 763 |
- decode: |
| 764 |
name: explicit float tag on negative one |
| 765 |
yaml: 'v: !!float -1' |
| 766 |
type: map[string]any |
| 767 |
want: |
| 768 |
v: -1.0 |
| 769 |
|
| 770 |
- decode: |
| 771 |
name: explicit null tag on empty string |
| 772 |
yaml: "v: !!null ''" |
| 773 |
type: map[string]any |
| 774 |
want: |
| 775 |
v: null |
| 776 |
|
| 777 |
- decode: |
| 778 |
name: TAG directive with int |
| 779 |
yaml: | |
| 780 |
%TAG !y! tag:yaml.org,2002: |
| 781 |
--- |
| 782 |
v: !y!int '1' |
| 783 |
type: map[string]any |
| 784 |
want: |
| 785 |
v: 1 |
| 786 |
|
| 787 |
- decode: |
| 788 |
name: non-specific tag |
| 789 |
yaml: 'v: ! test' |
| 790 |
type: map[string]any |
| 791 |
want: |
| 792 |
v: test |
| 793 |
|
| 794 |
|
| 795 |
- decode: |
| 796 |
name: decoding !!binary into any |
| 797 |
yaml: 'v: !!binary MTIzCg==' |
| 798 |
type: map[string]any |
| 799 |
want: |
| 800 |
v: "123\n" |
| 801 |
|
| 802 |
- decode: |
| 803 |
name: decoding !!binary into string |
| 804 |
yaml: 'v: !!binary MTIzCg==' |
| 805 |
type: map[string]string |
| 806 |
want: |
| 807 |
v: "123\n" |
| 808 |
|
| 809 |
- decode: |
| 810 |
name: decoding !!binary into []byte |
| 811 |
yaml: 'v: !!binary MTIzCg==' |
| 812 |
type: map[string][]byte |
| 813 |
want: |
| 814 |
v: [0x31, 0x32, 0x33, 0x0A] |
| 815 |
|
| 816 |
|
| 817 |
- decode: |
| 818 |
name: anchor as key with alias |
| 819 |
yaml: | |
| 820 |
foo: &bar bar |
| 821 |
*bar : quz |
| 822 |
type: map[string]any |
| 823 |
want: |
| 824 |
foo: bar |
| 825 |
bar: quz |
| 826 |
|
| 827 |
- decode: |
| 828 |
name: anchor with special characters |
| 829 |
yaml: | |
| 830 |
foo: &b./ar bar |
| 831 |
*b./ar : quz |
| 832 |
type: map[string]any |
| 833 |
want: |
| 834 |
foo: bar |
| 835 |
bar: quz |
| 836 |
|
| 837 |
- decode: |
| 838 |
name: alias reuse (yaml-test-suite 3GZX) |
| 839 |
yaml: | |
| 840 |
First occurrence: &anchor Foo |
| 841 |
Second occurrence: *anchor |
| 842 |
Override anchor: &anchor Bar |
| 843 |
Reuse anchor: *anchor |
| 844 |
type: map[string]any |
| 845 |
want: |
| 846 |
First occurrence: Foo |
| 847 |
Second occurrence: Foo |
| 848 |
Override anchor: Bar |
| 849 |
Reuse anchor: Bar |
| 850 |
|
| 851 |
|
| 852 |
- decode: |
| 853 |
name: flow sequence with colon-prefixed values |
| 854 |
yaml: 'seq: [:A,1,:C]' |
| 855 |
type: map[string]any |
| 856 |
want: |
| 857 |
seq: [':A', 1, ':C'] |
| 858 |
|
| 859 |
- decode: |
| 860 |
name: 'flow sequence with nested map using ::' |
| 861 |
yaml: 'seq: [:: A,1,:C]' |
| 862 |
type: map[string]any |
| 863 |
want: |
| 864 |
seq: |
| 865 |
- {':': A} |
| 866 |
- 1 |
| 867 |
- ':C' |
| 868 |
|
| 869 |
|
| 870 |
- decode: |
| 871 |
name: string with underscore after minus |
| 872 |
yaml: 'a: -b_c' |
| 873 |
type: map[string]any |
| 874 |
want: |
| 875 |
a: -b_c |
| 876 |
|
| 877 |
- decode: |
| 878 |
name: string with underscore after plus |
| 879 |
yaml: 'a: +b_c' |
| 880 |
type: map[string]any |
| 881 |
want: |
| 882 |
a: +b_c |
| 883 |
|
| 884 |
- decode: |
| 885 |
name: string starting with digit and underscore |
| 886 |
yaml: 'a: 50cent_of_dollar' |
| 887 |
type: map[string]any |
| 888 |
want: |
| 889 |
a: '50cent_of_dollar' |
| 890 |
|
| 891 |
|
| 892 |
- decode: |
| 893 |
name: URL in flow mapping |
| 894 |
yaml: 'a: {b: https://github.com/go-yaml/yaml}' |
| 895 |
type: map[string]any |
| 896 |
want: |
| 897 |
a: |
| 898 |
b: https://github.com/go-yaml/yaml |
| 899 |
|
| 900 |
- decode: |
| 901 |
name: URL in flow sequence |
| 902 |
yaml: 'a: [https://github.com/go-yaml/yaml]' |
| 903 |
type: map[string]any |
| 904 |
want: |
| 905 |
a: [https://github.com/go-yaml/yaml] |
| 906 |
|
| 907 |
- decode: |
| 908 |
name: angle brackets in string |
| 909 |
yaml: 'a: <foo>' |
| 910 |
type: map[string]string |
| 911 |
want: |
| 912 |
a: <foo> |
| 913 |
|
| 914 |
- decode: |
| 915 |
name: base 60 float as string |
| 916 |
yaml: | |
| 917 |
a: 1:1 |
| 918 |
type: map[string]string |
| 919 |
want: |
| 920 |
a: '1:1' |
| 921 |
|
| 922 |
|
| 923 |
- decode: |
| 924 |
name: scientific notation lowercase e |
| 925 |
yaml: | |
| 926 |
a: 123456e1 |
| 927 |
type: map[string]any |
| 928 |
want: |
| 929 |
a: 1.23456e+06 |
| 930 |
|
| 931 |
- decode: |
| 932 |
name: scientific notation uppercase E |
| 933 |
yaml: | |
| 934 |
a: 123456E1 |
| 935 |
type: map[string]any |
| 936 |
want: |
| 937 |
a: 1.23456e+06 |
| 938 |
|
| 939 |
|
| 940 |
- decode: |
| 941 |
name: unicode line breaks |
| 942 |
yaml: | |
| 943 |
%YAML 1.1 |
| 944 |
--- !!str |
| 945 |
"Generic line break (no glyph)\n\ |
| 946 |
Generic line break (glyphed)\n\ |
| 947 |
Line separator\u2028\ |
| 948 |
Paragraph separator\u2029" |
| 949 |
type: string |
| 950 |
want: "Generic line break (no glyph)\nGeneric line break (glyphed)\nLine separator\u2028Paragraph separator\u2029" |
| 951 |
|
| 952 |
|
| 953 |
- decode: |
| 954 |
name: quoted multiline string in sequence |
| 955 |
yaml: | |
| 956 |
v: |
| 957 |
- A |
| 958 |
- 'B |
| 959 |
|
| 960 |
C' |
| 961 |
type: map[string][]string |
| 962 |
want: |
| 963 |
v: [A, "B\nC"] |
| 964 |
|
| 965 |
|
| 966 |
- decode: |
| 967 |
name: document with trailing garbage |
| 968 |
yaml: | |
| 969 |
--- |
| 970 |
hello |
| 971 |
... |
| 972 |
}not yaml |
| 973 |
type: string |
| 974 |
want: hello |
| 975 |
|
| 976 |
|
| 977 |
- decode: |
| 978 |
name: struct field Hello maps to yaml key hello |
| 979 |
yaml: 'hello: world' |
| 980 |
type: testStructHello |
| 981 |
want: |
| 982 |
hello: world |
| 983 |
|
| 984 |
- decode: |
| 985 |
name: nested struct |
| 986 |
yaml: 'a: {b: c}' |
| 987 |
type: testStructA_NestedB |
| 988 |
want: |
| 989 |
a: |
| 990 |
b: c |
| 991 |
|
| 992 |
- decode: |
| 993 |
name: nested struct pointer |
| 994 |
yaml: 'a: {b: c}' |
| 995 |
type: testStructA_NestedBPtr |
| 996 |
want: |
| 997 |
a: |
| 998 |
b: c |
| 999 |
|
| 1000 |
- decode: |
| 1001 |
name: struct with map field |
| 1002 |
yaml: 'a: {b: c}' |
| 1003 |
type: testStructA_MapStringString |
| 1004 |
want: |
| 1005 |
a: |
| 1006 |
b: c |
| 1007 |
|
| 1008 |
- decode: |
| 1009 |
name: struct with pointer to map |
| 1010 |
yaml: 'a: {b: c}' |
| 1011 |
type: testStructA_MapStringStringPtr |
| 1012 |
want: |
| 1013 |
a: |
| 1014 |
b: c |
| 1015 |
|
| 1016 |
- decode: |
| 1017 |
name: struct with empty map field |
| 1018 |
yaml: 'a:' |
| 1019 |
type: testStructA_MapStringString |
| 1020 |
want: |
| 1021 |
a: {} |
| 1022 |
|
| 1023 |
- decode: |
| 1024 |
name: struct with int field |
| 1025 |
yaml: 'a: 1' |
| 1026 |
type: testStructA_Int |
| 1027 |
want: |
| 1028 |
a: 1 |
| 1029 |
|
| 1030 |
- decode: |
| 1031 |
name: struct with float64 field from int |
| 1032 |
yaml: 'a: 1' |
| 1033 |
type: testStructA_Float64 |
| 1034 |
want: |
| 1035 |
a: 1 |
| 1036 |
|
| 1037 |
- decode: |
| 1038 |
name: struct with int field from float |
| 1039 |
yaml: 'a: 1.0' |
| 1040 |
type: testStructA_Int |
| 1041 |
want: |
| 1042 |
a: 1 |
| 1043 |
|
| 1044 |
- decode: |
| 1045 |
name: struct with uint field from float |
| 1046 |
yaml: 'a: 1.0' |
| 1047 |
type: testStructA_Uint |
| 1048 |
want: |
| 1049 |
a: 1 |
| 1050 |
|
| 1051 |
- decode: |
| 1052 |
name: struct with int slice field |
| 1053 |
yaml: 'a: [1, 2]' |
| 1054 |
type: testStructA_IntSlice |
| 1055 |
want: |
| 1056 |
a: [1, 2] |
| 1057 |
|
| 1058 |
- decode: |
| 1059 |
name: struct with int array field |
| 1060 |
yaml: 'a: [1, 2]' |
| 1061 |
type: testStructA_IntArray2 |
| 1062 |
want: |
| 1063 |
a: [1, 2] |
| 1064 |
|
| 1065 |
- decode: |
| 1066 |
name: struct field mismatch ignored |
| 1067 |
yaml: 'a: 1' |
| 1068 |
type: testStructB_Int |
| 1069 |
want: |
| 1070 |
b: 0 |
| 1071 |
|
| 1072 |
- decode: |
| 1073 |
name: struct with bool field YAML 1.1 YES |
| 1074 |
yaml: 'a: YES' |
| 1075 |
type: testStructA_Bool |
| 1076 |
want: |
| 1077 |
a: true |
| 1078 |
|
| 1079 |
- decode: |
| 1080 |
name: struct with four int fields from anchors |
| 1081 |
yaml: | |
| 1082 |
a: &x 1 |
| 1083 |
b: &y 2 |
| 1084 |
c: *x |
| 1085 |
d: *y |
| 1086 |
type: testStructABCD_Int |
| 1087 |
want: |
| 1088 |
a: 1 |
| 1089 |
b: 2 |
| 1090 |
c: 1 |
| 1091 |
d: 2 |
| 1092 |
|
| 1093 |
- decode: |
| 1094 |
name: struct field B with anchor list |
| 1095 |
yaml: | |
| 1096 |
a: &a [1, 2] |
| 1097 |
b: *a |
| 1098 |
type: testStructB_IntSlice |
| 1099 |
want: |
| 1100 |
b: [1, 2] |
| 1101 |
|
| 1102 |
- decode: |
| 1103 |
name: struct with empty slice field |
| 1104 |
yaml: 'a: []' |
| 1105 |
type: testStructA_IntSliceEmpty |
| 1106 |
want: |
| 1107 |
a: [] |
| 1108 |
|
| 1109 |
|
| 1110 |
- decode: |
| 1111 |
name: yaml tag field rename (B to a) |
| 1112 |
yaml: 'a: 1' |
| 1113 |
type: testStructB_Int_TagA |
| 1114 |
want: |
| 1115 |
a: 1 |
| 1116 |
|
| 1117 |
- decode: |
| 1118 |
name: yaml tag ignored field |
| 1119 |
yaml: | |
| 1120 |
a: 1 |
| 1121 |
b: 2 |
| 1122 |
type: testStructAB_Int_BIgnored |
| 1123 |
want: |
| 1124 |
a: 1 |
| 1125 |
|
| 1126 |
- decode: |
| 1127 |
name: inline struct field |
| 1128 |
yaml: | |
| 1129 |
a: 1 |
| 1130 |
b: 2 |
| 1131 |
c: 3 |
| 1132 |
type: testStructA_Int_InlineB |
| 1133 |
want: |
| 1134 |
a: 1 |
| 1135 |
b: 2 |
| 1136 |
c: 3 |
| 1137 |
|
| 1138 |
- decode: |
| 1139 |
name: inline struct pointer field |
| 1140 |
yaml: | |
| 1141 |
a: 1 |
| 1142 |
b: 2 |
| 1143 |
c: 3 |
| 1144 |
type: testStructA_Int_InlineBPtr |
| 1145 |
want: |
| 1146 |
a: 1 |
| 1147 |
b: 2 |
| 1148 |
c: 3 |
| 1149 |
|
| 1150 |
- decode: |
| 1151 |
name: inline struct pointer field nil |
| 1152 |
yaml: 'a: 1' |
| 1153 |
type: testStructA_Int_InlineBPtr |
| 1154 |
want: |
| 1155 |
a: 1 |
| 1156 |
|
| 1157 |
- decode: |
| 1158 |
name: inline nested struct pointer |
| 1159 |
yaml: | |
| 1160 |
a: 1 |
| 1161 |
c: 3 |
| 1162 |
d: 4 |
| 1163 |
type: testStructA_Int_InlineDPtr |
| 1164 |
want: |
| 1165 |
a: 1 |
| 1166 |
c: 3 |
| 1167 |
d: 4 |
| 1168 |
|
| 1169 |
- decode: |
| 1170 |
name: inline map field |
| 1171 |
yaml: | |
| 1172 |
a: 1 |
| 1173 |
b: 2 |
| 1174 |
c: 3 |
| 1175 |
type: testStructA_Int_InlineMapStringInt |
| 1176 |
want: |
| 1177 |
a: 1 |
| 1178 |
b: 2 |
| 1179 |
c: 3 |
| 1180 |
|
| 1181 |
|
| 1182 |
- decode: |
| 1183 |
name: anchor and alias basic |
| 1184 |
yaml: | |
| 1185 |
foo: &bar bar |
| 1186 |
*bar : quz |
| 1187 |
type: map[string]any |
| 1188 |
want: |
| 1189 |
foo: bar |
| 1190 |
bar: quz |
| 1191 |
|
| 1192 |
- decode: |
| 1193 |
name: anchor and alias with special characters |
| 1194 |
yaml: | |
| 1195 |
foo: &b./ar bar |
| 1196 |
*b./ar : quz |
| 1197 |
type: map[string]any |
| 1198 |
want: |
| 1199 |
foo: bar |
| 1200 |
bar: quz |
| 1201 |
|
| 1202 |
|
| 1203 |
- decode: |
| 1204 |
name: null into map[string]string becomes empty string |
| 1205 |
yaml: | |
| 1206 |
foo: null |
| 1207 |
type: map[string]string |
| 1208 |
want: |
| 1209 |
foo: '' |
| 1210 |
|
| 1211 |
- decode: |
| 1212 |
name: null into map[string]any stays nil |
| 1213 |
yaml: | |
| 1214 |
foo: null |
| 1215 |
type: map[string]any |
| 1216 |
want: |
| 1217 |
foo: null |
| 1218 |
|
| 1219 |
|
| 1220 |
- decode: |
| 1221 |
name: tilde into map[string]string becomes empty string |
| 1222 |
yaml: | |
| 1223 |
foo: ~ |
| 1224 |
type: map[string]string |
| 1225 |
want: |
| 1226 |
foo: '' |
| 1227 |
|
| 1228 |
- decode: |
| 1229 |
name: tilde into map[string]any stays nil |
| 1230 |
yaml: | |
| 1231 |
foo: ~ |
| 1232 |
type: map[string]any |
| 1233 |
want: |
| 1234 |
foo: null |
| 1235 |
|
| 1236 |
|
| 1237 |
- decode: |
| 1238 |
name: quoted timestamp string stays as string |
| 1239 |
yaml: | |
| 1240 |
a: "2015-01-01" |
| 1241 |
type: map[string]any |
| 1242 |
want: |
| 1243 |
a: '2015-01-01' |
| 1244 |
|
| 1245 |
|
| 1246 |
- decode: |
| 1247 |
name: C1 control character U+0080 |
| 1248 |
yaml: "\u0080" |
| 1249 |
type: string |
| 1250 |
want: "\u0080" |
| 1251 |
|
| 1252 |
- decode: |
| 1253 |
name: C1 control character U+009F |
| 1254 |
yaml: "\u009F" |
| 1255 |
type: string |
| 1256 |
want: "\u009F" |
| 1257 |
|
| 1258 |
|
| 1259 |
- decode: |
| 1260 |
name: CRLF line endings |
| 1261 |
yaml: "a: b\r\nc:\r\n- d\r\n- e\r\n" |
| 1262 |
type: map[string]any |
| 1263 |
want: |
| 1264 |
a: b |
| 1265 |
c: |
| 1266 |
- d |
| 1267 |
- e |
| 1268 |
|
| 1269 |
|
| 1270 |
- decode: |
| 1271 |
name: question mark in middle of key and value |
| 1272 |
yaml: | |
| 1273 |
foo: {ba?r: a?bc} |
| 1274 |
type: map[string]any |
| 1275 |
want: |
| 1276 |
foo: |
| 1277 |
ba?r: a?bc |
| 1278 |
|
| 1279 |
- decode: |
| 1280 |
name: question mark at start of key and value |
| 1281 |
yaml: | |
| 1282 |
foo: {?bar: ?abc} |
| 1283 |
type: map[string]any |
| 1284 |
want: |
| 1285 |
foo: |
| 1286 |
'?bar': '?abc' |
| 1287 |
|
| 1288 |
- decode: |
| 1289 |
name: question mark at end of key and value |
| 1290 |
yaml: | |
| 1291 |
foo: {bar?: abc?} |
| 1292 |
type: map[string]any |
| 1293 |
want: |
| 1294 |
foo: |
| 1295 |
bar?: abc? |
| 1296 |
|
| 1297 |
- decode: |
| 1298 |
name: explicit key indicator with space |
| 1299 |
yaml: | |
| 1300 |
foo: {? key: value} |
| 1301 |
type: map[string]any |
| 1302 |
want: |
| 1303 |
foo: |
| 1304 |
key: value |
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
- decode: |
| 1309 |
name: Scalar string into TextUnmarshaler (value field) |
| 1310 |
yaml: 'a: hello world' |
| 1311 |
type: testStructA_TextUnmarshaler |
| 1312 |
want: |
| 1313 |
a: |
| 1314 |
value: hello world |
| 1315 |
|
| 1316 |
- decode: |
| 1317 |
name: Scalar string into TextUnmarshaler (pointer field) |
| 1318 |
yaml: 'a: hello world' |
| 1319 |
type: testStructA_TextUnmarshalerPtr |
| 1320 |
want: |
| 1321 |
a: |
| 1322 |
value: hello world |
| 1323 |
|
| 1324 |
- decode: |
| 1325 |
name: Scalar string into TextUnmarshaler (pointer-pointer field) |
| 1326 |
yaml: 'a: hello world' |
| 1327 |
type: testStructA_TextUnmarshalerPtrPtr |
| 1328 |
want: |
| 1329 |
a: |
| 1330 |
value: hello world |
| 1331 |
|
| 1332 |
- decode: |
| 1333 |
name: Null into TextUnmarshaler (value field) |
| 1334 |
yaml: 'a: null' |
| 1335 |
type: testStructA_TextUnmarshaler |
| 1336 |
want: |
| 1337 |
a: |
| 1338 |
value: '' |
| 1339 |
|
| 1340 |
- decode: |
| 1341 |
name: Null into TextUnmarshaler (pointer field) |
| 1342 |
yaml: 'a: null' |
| 1343 |
type: testStructA_TextUnmarshalerPtr |
| 1344 |
want: |
| 1345 |
a: null |
| 1346 |
|
| 1347 |
- decode: |
| 1348 |
name: Null into TextUnmarshaler (pointer-pointer field) |
| 1349 |
yaml: 'a: null' |
| 1350 |
type: testStructA_TextUnmarshalerPtrPtr |
| 1351 |
want: |
| 1352 |
a: null |
| 1353 |
|
| 1354 |
- decode: |
| 1355 |
name: Aliases and TextUnmarshaler |
| 1356 |
yaml: | |
| 1357 |
a: &foo hello world |
| 1358 |
b: *foo |
| 1359 |
type: testStructAB_TextUnmarshaler |
| 1360 |
want: |
| 1361 |
a: |
| 1362 |
value: hello world |
| 1363 |
b: |
| 1364 |
value: hello world |