this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

failing tests

+2489
+1
yaml/ocaml-yamle/.gitignore
··· 1 + _build
+859
yaml/ocaml-yamle/tests/cram/collections.t
··· 1 + Test collections_block.yml - Block style collections 2 + 3 + $ yamlcat ../yaml/collections_block.yml 4 + simple_sequence: 5 + - apple 6 + - banana 7 + - cherry 8 + - date 9 + simple_mapping: 10 + name: John Doe 11 + age: 30 12 + city: New York 13 + country: USA 14 + nested_sequences: 15 + - 16 + - alpha 17 + - beta 18 + - gamma 19 + - 20 + - one 21 + - two 22 + - three 23 + - 24 + - red 25 + - green 26 + - blue 27 + nested_mappings: 28 + person: 29 + name: Alice 30 + contact: 31 + email: alice@example.com 32 + phone: 555-1234 33 + address: 34 + street: 123 Main St 35 + city: Boston 36 + mapping_with_sequences: 37 + colors: 38 + - red 39 + - green 40 + - blue 41 + sizes: 42 + - small 43 + - medium 44 + - large 45 + numbers: 46 + - 1 47 + - 2 48 + - 3 49 + sequence_with_mappings: 50 + - name: Alice 51 + age: 25 52 + role: developer 53 + - name: Bob 54 + age: 30 55 + role: designer 56 + - name: Charlie 57 + age: 35 58 + role: manager 59 + deep_nesting: 60 + level1: 61 + level2: 62 + level3: 63 + level4: 64 + - deeply 65 + - nested 66 + - values 67 + another_key: value 68 + items: 69 + - item1 70 + - item2 71 + metadata: 72 + created: 2024-01-01 73 + modified: 2024-12-04 74 + complex_structure: 75 + database: 76 + connections: 77 + - host: db1.example.com 78 + port: 5432 79 + credentials: 80 + username: admin 81 + password: secret 82 + - host: db2.example.com 83 + port: 5432 84 + credentials: 85 + username: readonly 86 + password: public 87 + services: 88 + - name: api 89 + endpoints: 90 + - /users 91 + - /posts 92 + - /comments 93 + config: 94 + timeout: 30 95 + retries: 3 96 + - name: worker 97 + tasks: 98 + - email 99 + - reports 100 + config: 101 + concurrency: 10 102 + empty_collections: 103 + empty_sequence: 104 + empty_mapping: 105 + sequence_with_empty: 106 + - value1 107 + - 108 + - value2 109 + mapping_with_empty: 110 + key1: value1 111 + key2: 112 + key3: value3 113 + 114 + Test collections_block.yml with JSON output 115 + 116 + $ yamlcat --json ../yaml/collections_block.yml 117 + {"simple_sequence": ["apple", "banana", "cherry", "date"], "simple_mapping": {"name": "John Doe", "age": 30, "city": "New York", "country": "USA"}, "nested_sequences": [["alpha", "beta", "gamma"], ["one", "two", "three"], ["red", "green", "blue"]], "nested_mappings": {"person": {"name": "Alice", "contact": {"email": "alice@example.com", "phone": "555-1234"}, "address": {"street": "123 Main St", "city": "Boston"}}}, "mapping_with_sequences": {"colors": ["red", "green", "blue"], "sizes": ["small", "medium", "large"], "numbers": [1, 2, 3]}, "sequence_with_mappings": [{"name": "Alice", "age": 25, "role": "developer"}, {"name": "Bob", "age": 30, "role": "designer"}, {"name": "Charlie", "age": 35, "role": "manager"}], "deep_nesting": {"level1": {"level2": {"level3": {"level4": ["deeply", "nested", "values"], "another_key": "value"}, "items": ["item1", "item2"]}, "metadata": {"created": "2024-01-01", "modified": "2024-12-04"}}}, "complex_structure": {"database": {"connections": [{"host": "db1.example.com", "port": 5432, "credentials": {"username": "admin", "password": "secret"}}, {"host": "db2.example.com", "port": 5432, "credentials": {"username": "readonly", "password": "public"}}]}, "services": [{"name": "api", "endpoints": ["/users", "/posts", "/comments"], "config": {"timeout": 30, "retries": 3}}, {"name": "worker", "tasks": ["email", "reports"], "config": {"concurrency": 10}}]}, "empty_collections": {"empty_sequence": [], "empty_mapping": {}, "sequence_with_empty": ["value1", [], "value2"], "mapping_with_empty": {"key1": "value1", "key2": {}, "key3": "value3"}}} 118 + 119 + Test collections_block.yml with flow output 120 + 121 + $ yamlcat --flow ../yaml/collections_block.yml 122 + {simple_sequence: [apple, banana, cherry, date]simple_mapping, {name: John Doe, age: 30, city: New York, country: USA}, nested_sequences: [[alpha, beta, gamma], [one, two, three], [red, green, blue]]nested_mappings, {person: {name: Alice, contact: {email: alice@example.com, phone: 555-1234}address, {street: 123 Main St, city: Boston}}}, mapping_with_sequences: {colors: [red, green, blue]sizes, [small, medium, large], numbers: [1, 2, 3]}sequence_with_mappings, [{name: Alice, age: 25, role: developer}, {name: Bob, age: 30, role: designer}, {name: Charlie, age: 35, role: manager}], deep_nesting: {level1: {level2: {level3: {level4: [deeply, nested, values]another_key, value: }items, [item1, item2]}metadata, {created: 2024-01-01, modified: 2024-12-04}}}complex_structure, {database: {connections: [{host: db1.example.com, port: 5432, credentials: {username: admin, password: secret}}, {host: db2.example.com, port: 5432, credentials: {username: readonly, password: public}}]}services, [{name: api, endpoints: [/users, /posts, /comments]config, {timeout: 30, retries: 3}}, {name: worker, tasks: [email, reports]config, {concurrency: 10}}]}, empty_collections: {empty_sequence: []empty_mapping, {}, sequence_with_empty: [value1, [], value2]mapping_with_empty, {key1: value1, key2: {}key3, value3: }}} 123 + 124 + Test collections_compact.yml - Compact notation 125 + 126 + $ yamlcat ../yaml/collections_compact.yml 127 + compact_sequence: 128 + - name: Alice 129 + age: 25 130 + city: Boston 131 + - name: Bob 132 + age: 30 133 + city: Seattle 134 + - name: Charlie 135 + age: 35 136 + city: Portland 137 + compact_nested: 138 + - id: 1 139 + details: 140 + type: admin 141 + permissions: 142 + - read 143 + - write 144 + - delete 145 + - id: 2 146 + details: 147 + type: user 148 + permissions: 149 + - read 150 + compact_complex: 151 + - key1: value1 152 + key2: value2 153 + nested: 154 + sub1: val1 155 + sub2: val2 156 + - key1: value3 157 + key2: value4 158 + nested: 159 + sub1: val3 160 + sub2: val4 161 + users: 162 + - username: alice 163 + email: alice@example.com 164 + active: true 165 + - username: bob 166 + email: bob@example.com 167 + active: false 168 + compact_with_flow: 169 + - name: service1 170 + ports: 171 + - 8080 172 + - 8443 173 + env: 174 + DEBUG: true 175 + MODE: production 176 + - name: service2 177 + ports: 178 + - 3000 179 + env: 180 + DEBUG: false 181 + MODE: development 182 + deep_compact: 183 + - category: electronics 184 + items: 185 + - name: laptop 186 + specs: 187 + cpu: Intel i7 188 + ram: 16GB 189 + storage: 512GB SSD 190 + - name: phone 191 + specs: 192 + os: Android 193 + ram: 8GB 194 + storage: 256GB 195 + - category: furniture 196 + items: 197 + - name: desk 198 + dimensions: 199 + width: 150cm 200 + depth: 75cm 201 + height: 75cm 202 + - name: chair 203 + dimensions: 204 + width: 60cm 205 + depth: 60cm 206 + height: 120cm 207 + mixed_compact: 208 + databases: 209 + - type: postgresql 210 + connection: 211 + host: localhost 212 + port: 5432 213 + credentials: 214 + user: admin 215 + password: secret 216 + - type: mongodb 217 + connection: 218 + host: localhost 219 + port: 27017 220 + credentials: 221 + user: root 222 + password: root 223 + single_line_compact: 224 + - name: Alice 225 + age: 25 226 + role: developer 227 + - name: Bob 228 + age: 30 229 + role: designer 230 + - name: Charlie 231 + age: 35 232 + role: manager 233 + sequences_in_compact: 234 + - title: Project A 235 + members: 236 + - Alice 237 + - Bob 238 + - Charlie 239 + tags: 240 + - urgent 241 + - backend 242 + - title: Project B 243 + members: 244 + - David 245 + - Eve 246 + tags: 247 + - frontend 248 + - design 249 + compact_with_empty: 250 + - id: 1 251 + data: 252 + meta: 253 + - id: 2 254 + data: 255 + - item1 256 + meta: 257 + key: value 258 + compact_complex_nesting: 259 + - level: 1 260 + children: 261 + - level: 2a 262 + children: 263 + - level: 3a 264 + value: leaf1 265 + - level: 3b 266 + value: leaf2 267 + - level: 2b 268 + children: 269 + - level: 3c 270 + value: leaf3 271 + api_endpoints: 272 + - path: /users 273 + method: GET 274 + auth: required 275 + params: 276 + - name: page 277 + type: integer 278 + default: 1 279 + - name: limit 280 + type: integer 281 + default: 10 282 + - path: '/users/:id' 283 + method: GET 284 + auth: required 285 + params: 286 + - path: /users 287 + method: POST 288 + auth: required 289 + body: 290 + username: string 291 + email: string 292 + password: string 293 + compact_types: 294 + - string_val: hello 295 + number_val: 42 296 + float_val: 3.14 297 + bool_val: true 298 + null_val: null 299 + - string_val: world 300 + number_val: 100 301 + float_val: 2.71 302 + bool_val: false 303 + null_val: null 304 + minimal: 305 + - a: 1 306 + - b: 2 307 + - c: 3 308 + 309 + Test collections_compact.yml with JSON output 310 + 311 + $ yamlcat --json ../yaml/collections_compact.yml 312 + {"compact_sequence": [{"name": "Alice", "age": 25, "city": "Boston"}, {"name": "Bob", "age": 30, "city": "Seattle"}, {"name": "Charlie", "age": 35, "city": "Portland"}], "compact_nested": [{"id": 1, "details": {"type": "admin", "permissions": ["read", "write", "delete"]}}, {"id": 2, "details": {"type": "user", "permissions": ["read"]}}], "compact_complex": [{"key1": "value1", "key2": "value2", "nested": {"sub1": "val1", "sub2": "val2"}}, {"key1": "value3", "key2": "value4", "nested": {"sub1": "val3", "sub2": "val4"}}], "users": [{"username": "alice", "email": "alice@example.com", "active": true}, {"username": "bob", "email": "bob@example.com", "active": false}], "compact_with_flow": [{"name": "service1", "ports": [8080, 8443], "env": {"DEBUG": true, "MODE": "production"}}, {"name": "service2", "ports": [3000], "env": {"DEBUG": false, "MODE": "development"}}], "deep_compact": [{"category": "electronics", "items": [{"name": "laptop", "specs": {"cpu": "Intel i7", "ram": "16GB", "storage": "512GB SSD"}}, {"name": "phone", "specs": {"os": "Android", "ram": "8GB", "storage": "256GB"}}]}, {"category": "furniture", "items": [{"name": "desk", "dimensions": {"width": "150cm", "depth": "75cm", "height": "75cm"}}, {"name": "chair", "dimensions": {"width": "60cm", "depth": "60cm", "height": "120cm"}}]}], "mixed_compact": {"databases": [{"type": "postgresql", "connection": {"host": "localhost", "port": 5432}, "credentials": {"user": "admin", "password": "secret"}}, {"type": "mongodb", "connection": {"host": "localhost", "port": 27017}, "credentials": {"user": "root", "password": "root"}}]}, "single_line_compact": [{"name": "Alice", "age": 25, "role": "developer"}, {"name": "Bob", "age": 30, "role": "designer"}, {"name": "Charlie", "age": 35, "role": "manager"}], "sequences_in_compact": [{"title": "Project A", "members": ["Alice", "Bob", "Charlie"], "tags": ["urgent", "backend"]}, {"title": "Project B", "members": ["David", "Eve"], "tags": ["frontend", "design"]}], "compact_with_empty": [{"id": 1, "data": [], "meta": {}}, {"id": 2, "data": ["item1"], "meta": {"key": "value"}}], "compact_complex_nesting": [{"level": 1, "children": [{"level": "2a", "children": [{"level": "3a", "value": "leaf1"}, {"level": "3b", "value": "leaf2"}]}, {"level": "2b", "children": [{"level": "3c", "value": "leaf3"}]}]}], "api_endpoints": [{"path": "/users", "method": "GET", "auth": "required", "params": [{"name": "page", "type": "integer", "default": 1}, {"name": "limit", "type": "integer", "default": 10}]}, {"path": "/users/:id", "method": "GET", "auth": "required", "params": []}, {"path": "/users", "method": "POST", "auth": "required", "body": {"username": "string", "email": "string", "password": "string"}}], "compact_types": [{"string_val": "hello", "number_val": 42, "float_val": 3.14, "bool_val": true, "null_val": null}, {"string_val": "world", "number_val": 100, "float_val": 2.71, "bool_val": false, "null_val": null}], "minimal": [{"a": 1}, {"b": 2}, {"c": 3}]} 313 + 314 + Test collections_compact.yml with flow output 315 + 316 + $ yamlcat --flow ../yaml/collections_compact.yml 317 + {compact_sequence: [{name: Alice, age: 25, city: Boston}, {name: Bob, age: 30, city: Seattle}, {name: Charlie, age: 35, city: Portland}]compact_nested, [{id: 1, details: {type: admin, permissions: [read, write, delete]}}, {id: 2, details: {type: user, permissions: [read]}}], compact_complex: [{key1: value1, key2: value2, nested: {sub1: val1, sub2: val2}}, {key1: value3, key2: value4, nested: {sub1: val3, sub2: val4}}]users, [{username: alice, email: alice@example.com, active: true}, {username: bob, email: bob@example.com, active: false}], compact_with_flow: [{name: service1, ports: [8080, 8443]env, {DEBUG: true, MODE: production}}, {name: service2, ports: [3000]env, {DEBUG: false, MODE: development}}]deep_compact, [{category: electronics, items: [{name: laptop, specs: {cpu: Intel i7, ram: 16GB, storage: 512GB SSD}}, {name: phone, specs: {os: Android, ram: 8GB, storage: 256GB}}]}, {category: furniture, items: [{name: desk, dimensions: {width: 150cm, depth: 75cm, height: 75cm}}, {name: chair, dimensions: {width: 60cm, depth: 60cm, height: 120cm}}]}], mixed_compact: {databases: [{type: postgresql, connection: {host: localhost, port: 5432}credentials, {user: admin, password: secret}}, {type: mongodb, connection: {host: localhost, port: 27017}credentials, {user: root, password: root}}]}single_line_compact, [{name: Alice, age: 25, role: developer}, {name: Bob, age: 30, role: designer}, {name: Charlie, age: 35, role: manager}], sequences_in_compact: [{title: Project A, members: [Alice, Bob, Charlie]tags, [urgent, backend]}, {title: Project B, members: [David, Eve]tags, [frontend, design]}]compact_with_empty, [{id: 1, data: []meta, {}}, {id: 2, data: [item1]meta, {key: value}}], compact_complex_nesting: [{level: 1, children: [{level: 2a, children: [{level: 3a, value: leaf1}, {level: 3b, value: leaf2}]}, {level: 2b, children: [{level: 3c, value: leaf3}]}]}]api_endpoints, [{path: /users, method: GET, auth: required, params: [{name: page, type: integer, default: 1}, {name: limit, type: integer, default: 10}]}, {path: '/users/:id', method: GET, auth: required, params: []}, {path: /users, method: POST, auth: required, body: {username: string, email: string, password: string}}], compact_types: [{string_val: hello, number_val: 42, float_val: 3.14, bool_val: true, null_val: null}, {string_val: world, number_val: 100, float_val: 2.71, bool_val: false, null_val: null}]minimal, [{a: 1}, {b: 2}, {c: 3}]} 318 + 319 + Test collections_flow.yml - Flow style collections 320 + 321 + $ yamlcat ../yaml/collections_flow.yml 322 + simple_flow_sequence: 323 + - apple 324 + - banana 325 + - cherry 326 + - date 327 + simple_flow_mapping: 328 + name: John 329 + age: 30 330 + city: New York 331 + nested_flow_sequences: 332 + - 333 + - a 334 + - b 335 + - c 336 + - 337 + - 1 338 + - 2 339 + - 3 340 + - 341 + - red 342 + - green 343 + - blue 344 + nested_flow_mappings: 345 + person: 346 + name: Alice 347 + age: 25 348 + contact: 349 + email: alice@example.com 350 + phone: 555-1234 351 + flow_seq_with_maps: 352 + - name: Alice 353 + role: dev 354 + - name: Bob 355 + role: ops 356 + - name: Charlie 357 + role: qa 358 + flow_map_with_seqs: 359 + colors: 360 + - red 361 + - green 362 + - blue 363 + sizes: 364 + - S 365 + - M 366 + - L 367 + numbers: 368 + - 1 369 + - 2 370 + - 3 371 + deep_flow_nesting: 372 + level1: 373 + level2: 374 + level3: 375 + level4: 376 + - a 377 + - b 378 + - c 379 + empty_flow: 380 + empty_seq: 381 + empty_map: 382 + both: 383 + - 384 + - flow_in_block: 385 + sequence: 386 + - 1 387 + - 2 388 + - 3 389 + - 4 390 + - 5 391 + mapping: 392 + a: 1 393 + b: 2 394 + c: 3 395 + nested: 396 + items: 397 + - x 398 + - y 399 + - z 400 + config: 401 + timeout: 30 402 + retries: 3 403 + block_in_flow: 404 + users: 405 + - name: Alice 406 + tags: 407 + - dev 408 + - senior 409 + - name: Bob 410 + tags: 411 + - ops 412 + - junior 413 + mixed_structure: 414 + services: 415 + - name: api 416 + ports: 417 + - 8080 418 + - 8443 419 + env: 420 + DEBUG: true 421 + LOG_LEVEL: info 422 + - name: db 423 + ports: 424 + - 5432 425 + env: 426 + POSTGRES_DB: mydb 427 + POSTGRES_USER: admin 428 + config: 429 + version: 1 430 + enabled: true 431 + flow_types: 432 + strings: 433 + - hello 434 + - world 435 + - foo 436 + - bar 437 + numbers: 438 + - 1 439 + - 2 440 + - 3 441 + - 42 442 + - 100 443 + mixed: 444 + - string 445 + - 123 446 + - true 447 + - false 448 + - null 449 + quoted: 450 + - with spaces 451 + - 'special:chars' 452 + - commas, here 453 + flow_map_types: 454 + string: value 455 + number: 42 456 + boolean: true 457 + null_value: null 458 + float: 3.14 459 + nested_mixed: 460 + - id: 1 461 + data: 462 + - a 463 + - b 464 + - c 465 + meta: 466 + type: first 467 + - id: 2 468 + data: 469 + - d 470 + - e 471 + - f 472 + meta: 473 + type: second 474 + - id: 3 475 + data: 476 + - g 477 + - h 478 + - i 479 + meta: 480 + type: third 481 + multiline_flow: 482 + long_sequence: 483 + - item1 484 + - item2 485 + - item3 486 + - item4 487 + long_mapping: 488 + key1: value1 489 + key2: value2 490 + key3: value3 491 + edge_cases: 492 + single_item_seq: 493 + - alone 494 + single_item_map: 495 + only: one 496 + nested_empty: 497 + - 498 + - 499 + - - 500 + - - 501 + all_empty: 502 + - - 503 + - a: 504 + - b: 505 + 506 + Test collections_flow.yml with JSON output 507 + 508 + $ yamlcat --json ../yaml/collections_flow.yml 509 + {"simple_flow_sequence": ["apple", "banana", "cherry", "date"], "simple_flow_mapping": {"name": "John", "age": 30, "city": "New York"}, "nested_flow_sequences": [["a", "b", "c"], [1, 2, 3], ["red", "green", "blue"]], "nested_flow_mappings": {"person": {"name": "Alice", "age": 25}, "contact": {"email": "alice@example.com", "phone": "555-1234"}}, "flow_seq_with_maps": [{"name": "Alice", "role": "dev"}, {"name": "Bob", "role": "ops"}, {"name": "Charlie", "role": "qa"}], "flow_map_with_seqs": {"colors": ["red", "green", "blue"], "sizes": ["S", "M", "L"], "numbers": [1, 2, 3]}, "deep_flow_nesting": {"level1": {"level2": {"level3": {"level4": ["a", "b", "c"]}}}}, "empty_flow": {"empty_seq": [], "empty_map": {}, "both": [[], {}]}, "flow_in_block": {"sequence": [1, 2, 3, 4, 5], "mapping": {"a": 1, "b": 2, "c": 3}, "nested": {"items": ["x", "y", "z"], "config": {"timeout": 30, "retries": 3}}}, "block_in_flow": {"users": [{"name": "Alice", "tags": ["dev", "senior"]}, {"name": "Bob", "tags": ["ops", "junior"]}]}, "mixed_structure": {"services": [{"name": "api", "ports": [8080, 8443], "env": {"DEBUG": true, "LOG_LEVEL": "info"}}, {"name": "db", "ports": [5432], "env": {"POSTGRES_DB": "mydb", "POSTGRES_USER": "admin"}}], "config": {"version": 1, "enabled": true}}, "flow_types": {"strings": ["hello", "world", "foo", "bar"], "numbers": [1, 2, 3, 42, 100], "mixed": ["string", 123, true, false, null], "quoted": ["with spaces", "special:chars", "commas, here"]}, "flow_map_types": {"string": "value", "number": 42, "boolean": true, "null_value": null, "float": 3.14}, "nested_mixed": [{"id": 1, "data": ["a", "b", "c"], "meta": {"type": "first"}}, {"id": 2, "data": ["d", "e", "f"], "meta": {"type": "second"}}, {"id": 3, "data": ["g", "h", "i"], "meta": {"type": "third"}}], "multiline_flow": {"long_sequence": ["item1", "item2", "item3", "item4"], "long_mapping": {"key1": "value1", "key2": "value2", "key3": "value3"}}, "edge_cases": {"single_item_seq": ["alone"], "single_item_map": {"only": "one"}, "nested_empty": [[], [{}], [{}, []]], "all_empty": [{}, [], {"a": []}, {"b": {}}]}} 510 + 511 + Test collections_flow.yml with flow output 512 + 513 + $ yamlcat --flow ../yaml/collections_flow.yml 514 + {simple_flow_sequence: [apple, banana, cherry, date]simple_flow_mapping, {name: John, age: 30, city: New York}, nested_flow_sequences: [[a, b, c], [1, 2, 3], [red, green, blue]]nested_flow_mappings, {person: {name: Alice, age: 25}contact, {email: alice@example.com, phone: 555-1234}}, flow_seq_with_maps: [{name: Alice, role: dev}, {name: Bob, role: ops}, {name: Charlie, role: qa}]flow_map_with_seqs, {colors: [red, green, blue]sizes, [S, M, L], numbers: [1, 2, 3]}, deep_flow_nesting: {level1: {level2: {level3: {level4: [a, b, c]}}}}empty_flow, {empty_seq: []empty_map, {}, both: [[], {}]}, flow_in_block: {sequence: [1, 2, 3, 4, 5]mapping, {a: 1, b: 2, c: 3}, nested: {items: [x, y, z]config, {timeout: 30, retries: 3}}}block_in_flow, {users: [{name: Alice, tags: [dev, senior]}, {name: Bob, tags: [ops, junior]}]}, mixed_structure: {services: [{name: api, ports: [8080, 8443]env, {DEBUG: true, LOG_LEVEL: info}}, {name: db, ports: [5432]env, {POSTGRES_DB: mydb, POSTGRES_USER: admin}}]config, {version: 1, enabled: true}}flow_types, {strings: [hello, world, foo, bar]numbers, [1, 2, 3, 42, 100], mixed: [string, 123, true, false, null]quoted, [with spaces, 'special:chars', commas, here]}, flow_map_types: {string: value, number: 42, boolean: true, null_value: null, float: 3.14}nested_mixed, [{id: 1, data: [a, b, c]meta, {type: first}}, {id: 2, data: [d, e, f]meta, {type: second}}, {id: 3, data: [g, h, i]meta, {type: third}}], multiline_flow: {long_sequence: [item1, item2, item3, item4]long_mapping, {key1: value1, key2: value2, key3: value3}}edge_cases, {single_item_seq: [alone]single_item_map, {only: one}, nested_empty: [[], [{}], [{}, []]]all_empty, [{}, [], {a: []}, {b: {}}]}} 515 + 516 + Inline test: Simple sequence 517 + 518 + $ echo '- a 519 + > - b 520 + > - c' | yamlcat 521 + - a 522 + - b 523 + - c 524 + 525 + $ echo '- a 526 + > - b 527 + > - c' | yamlcat --json 528 + ["a", "b", "c"] 529 + 530 + $ echo '- a 531 + > - b 532 + > - c' | yamlcat --flow 533 + [a, b, c] 534 + 535 + Inline test: Simple mapping 536 + 537 + $ echo 'key1: value1 538 + > key2: value2 539 + > key3: value3' | yamlcat 540 + key1: value1 541 + key2: value2 542 + key3: value3 543 + 544 + $ echo 'key1: value1 545 + > key2: value2 546 + > key3: value3' | yamlcat --json 547 + {"key1": "value1", "key2": "value2", "key3": "value3"} 548 + 549 + $ echo 'key1: value1 550 + > key2: value2 551 + > key3: value3' | yamlcat --flow 552 + {key1: value1, key2: value2, key3: value3} 553 + 554 + Inline test: Nested sequences 555 + 556 + $ echo 'outer: 557 + > - - inner1 558 + > - inner2 559 + > - - inner3 560 + > - inner4' | yamlcat 561 + outer: 562 + - 563 + - inner1 564 + - inner2 565 + - 566 + - inner3 567 + - inner4 568 + 569 + $ echo 'outer: 570 + > - - inner1 571 + > - inner2 572 + > - - inner3 573 + > - inner4' | yamlcat --json 574 + {"outer": [["inner1", "inner2"], ["inner3", "inner4"]]} 575 + 576 + $ echo 'outer: 577 + > - - inner1 578 + > - inner2 579 + > - - inner3 580 + > - inner4' | yamlcat --flow 581 + {outer: [[inner1, inner2], [inner3, inner4]]} 582 + 583 + Inline test: Nested mappings 584 + 585 + $ echo 'level1: 586 + > level2: 587 + > level3: 588 + > key: value' | yamlcat 589 + level1: 590 + level2: 591 + level3: 592 + key: value 593 + 594 + $ echo 'level1: 595 + > level2: 596 + > level3: 597 + > key: value' | yamlcat --json 598 + {"level1": {"level2": {"level3": {"key": "value"}}}} 599 + 600 + $ echo 'level1: 601 + > level2: 602 + > level3: 603 + > key: value' | yamlcat --flow 604 + {level1: {level2: {level3: {key: value}}}} 605 + 606 + Inline test: Flow sequence 607 + 608 + $ echo '[a, b, c]' | yamlcat 609 + - a 610 + - b 611 + - c 612 + 613 + $ echo '[a, b, c]' | yamlcat --json 614 + ["a", "b", "c"] 615 + 616 + $ echo '[a, b, c]' | yamlcat --flow 617 + [a, b, c] 618 + 619 + Inline test: Flow mapping 620 + 621 + $ echo '{a: 1, b: 2, c: 3}' | yamlcat 622 + a: 1 623 + b: 2 624 + c: 3 625 + 626 + $ echo '{a: 1, b: 2, c: 3}' | yamlcat --json 627 + {"a": 1, "b": 2, "c": 3} 628 + 629 + $ echo '{a: 1, b: 2, c: 3}' | yamlcat --flow 630 + {a: 1, b: 2, c: 3} 631 + 632 + Inline test: Nested flow collections 633 + 634 + $ echo '[[1, 2], [3, 4], [5, 6]]' | yamlcat 635 + - 636 + - 1 637 + - 2 638 + - 639 + - 3 640 + - 4 641 + - 642 + - 5 643 + - 6 644 + 645 + $ echo '[[1, 2], [3, 4], [5, 6]]' | yamlcat --json 646 + [[1, 2], [3, 4], [5, 6]] 647 + 648 + $ echo '[[1, 2], [3, 4], [5, 6]]' | yamlcat --flow 649 + [[1, 2], [3, 4], [5, 6]] 650 + 651 + Inline test: Flow mapping with nested mapping 652 + 653 + $ echo '{outer: {inner: value}}' | yamlcat 654 + outer: 655 + inner: value 656 + 657 + $ echo '{outer: {inner: value}}' | yamlcat --json 658 + {"outer": {"inner": "value"}} 659 + 660 + $ echo '{outer: {inner: value}}' | yamlcat --flow 661 + {outer: {inner: value}} 662 + 663 + Inline test: Mixed block and flow (flow in block) 664 + 665 + $ echo 'block_key: 666 + > flow_seq: [1, 2, 3] 667 + > flow_map: {a: 1, b: 2}' | yamlcat 668 + block_key: 669 + flow_seq: 670 + - 1 671 + - 2 672 + - 3 673 + flow_map: 674 + a: 1 675 + b: 2 676 + 677 + $ echo 'block_key: 678 + > flow_seq: [1, 2, 3] 679 + > flow_map: {a: 1, b: 2}' | yamlcat --json 680 + {"block_key": {"flow_seq": [1, 2, 3], "flow_map": {"a": 1, "b": 2}}} 681 + 682 + $ echo 'block_key: 683 + > flow_seq: [1, 2, 3] 684 + > flow_map: {a: 1, b: 2}' | yamlcat --flow 685 + {block_key: {flow_seq: [1, 2, 3]flow_map, {a: 1, b: 2}}} 686 + 687 + Inline test: Mixed block and flow (block in flow) 688 + 689 + $ echo '{users: [{name: Alice, age: 30}, {name: Bob, age: 25}]}' | yamlcat 690 + users: 691 + - name: Alice 692 + age: 30 693 + - name: Bob 694 + age: 25 695 + 696 + $ echo '{users: [{name: Alice, age: 30}, {name: Bob, age: 25}]}' | yamlcat --json 697 + {"users": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]} 698 + 699 + $ echo '{users: [{name: Alice, age: 30}, {name: Bob, age: 25}]}' | yamlcat --flow 700 + {users: [{name: Alice, age: 30}, {name: Bob, age: 25}]} 701 + 702 + Inline test: Compact notation - sequence of mappings 703 + 704 + $ echo '- name: Alice 705 + > role: dev 706 + > - name: Bob 707 + > role: ops' | yamlcat 708 + - name: Alice 709 + role: dev 710 + - name: Bob 711 + role: ops 712 + 713 + $ echo '- name: Alice 714 + > role: dev 715 + > - name: Bob 716 + > role: ops' | yamlcat --json 717 + [{"name": "Alice", "role": "dev"}, {"name": "Bob", "role": "ops"}] 718 + 719 + $ echo '- name: Alice 720 + > role: dev 721 + > - name: Bob 722 + > role: ops' | yamlcat --flow 723 + [{name: Alice, role: dev}, {name: Bob, role: ops}] 724 + 725 + Inline test: Compact with nested collections 726 + 727 + $ echo '- id: 1 728 + > tags: [a, b, c] 729 + > config: 730 + > enabled: true 731 + > - id: 2 732 + > tags: [x, y, z] 733 + > config: 734 + > enabled: false' | yamlcat 735 + - id: 1 736 + tags: 737 + - a 738 + - b 739 + - c 740 + config: 741 + enabled: true 742 + - id: 2 743 + tags: 744 + - x 745 + - y 746 + - z 747 + config: 748 + enabled: false 749 + 750 + $ echo '- id: 1 751 + > tags: [a, b, c] 752 + > config: 753 + > enabled: true 754 + > - id: 2 755 + > tags: [x, y, z] 756 + > config: 757 + > enabled: false' | yamlcat --json 758 + [{"id": 1, "tags": ["a", "b", "c"], "config": {"enabled": true}}, {"id": 2, "tags": ["x", "y", "z"], "config": {"enabled": false}}] 759 + 760 + $ echo '- id: 1 761 + > tags: [a, b, c] 762 + > config: 763 + > enabled: true 764 + > - id: 2 765 + > tags: [x, y, z] 766 + > config: 767 + > enabled: false' | yamlcat --flow 768 + [{id: 1, tags: [a, b, c]config, {enabled: true}}, {id: 2, tags: [x, y, z]config, {enabled: false}}] 769 + 770 + Inline test: Empty collections 771 + 772 + $ echo 'empty_seq: [] 773 + > empty_map: {}' | yamlcat 774 + empty_seq: 775 + empty_map: 776 + 777 + $ echo 'empty_seq: [] 778 + > empty_map: {}' | yamlcat --json 779 + {"empty_seq": [], "empty_map": {}} 780 + 781 + $ echo 'empty_seq: [] 782 + > empty_map: {}' | yamlcat --flow 783 + {empty_seq: []empty_map, {}} 784 + 785 + Inline test: Sequence with mapping values 786 + 787 + $ echo 'items: 788 + > - apple 789 + > - banana 790 + > config: 791 + > mode: fast' | yamlcat 792 + items: 793 + - apple 794 + - banana 795 + config: 796 + mode: fast 797 + 798 + $ echo 'items: 799 + > - apple 800 + > - banana 801 + > config: 802 + > mode: fast' | yamlcat --json 803 + {"items": ["apple", "banana"], "config": {"mode": "fast"}} 804 + 805 + $ echo 'items: 806 + > - apple 807 + > - banana 808 + > config: 809 + > mode: fast' | yamlcat --flow 810 + {items: [apple, banana]config, {mode: fast}} 811 + 812 + Inline test: Complex nested structure 813 + 814 + $ echo 'services: 815 + > - name: web 816 + > ports: 817 + > - 80 818 + > - 443 819 + > env: 820 + > DEBUG: false 821 + > MODE: prod' | yamlcat 822 + services: 823 + - name: web 824 + ports: 825 + - 80 826 + - 443 827 + env: 828 + DEBUG: false 829 + MODE: prod 830 + 831 + $ echo 'services: 832 + > - name: web 833 + > ports: 834 + > - 80 835 + > - 443 836 + > env: 837 + > DEBUG: false 838 + > MODE: prod' | yamlcat --json 839 + {"services": [{"name": "web", "ports": [80, 443], "env": {"DEBUG": false, "MODE": "prod"}}]} 840 + 841 + $ echo 'services: 842 + > - name: web 843 + > ports: 844 + > - 80 845 + > - 443 846 + > env: 847 + > DEBUG: false 848 + > MODE: prod' | yamlcat --flow 849 + {services: [{name: web, ports: [80, 443]env, {DEBUG: false, MODE: prod}}]} 850 + 851 + Inline test: Flow sequence with various types 852 + 853 + $ echo '[string, 42, true, false, null, 3.14]' | yamlcat --json 854 + ["string", 42, true, false, null, 3.14] 855 + 856 + Inline test: Flow mapping with various types 857 + 858 + $ echo '{str: hello, num: 42, bool: true, nil: null, float: 3.14}' | yamlcat --json 859 + {"str": "hello", "num": 42, "bool": true, "nil": null, "float": 3.14}
+197
yaml/ocaml-yamle/tests/cram/comments.t
··· 1 + Test comments.yml file with various comment styles 2 + 3 + $ yamlcat ../yaml/comments.yml 4 + name: John Doe 5 + age: 30 6 + address: 7 + street: 123 Main St 8 + city: Springfield 9 + zip: 12345 10 + items: 11 + - apple 12 + - banana 13 + - cherry 14 + - date 15 + flow_seq: 16 + - 1 17 + - 2 18 + - 3 19 + flow_map: 20 + key1: value1 21 + key2: value2 22 + nested: 23 + level1: 24 + level2: 25 + value: deeply nested 26 + multi_comment_key: value 27 + special: 'value with # hash inside quotes' 28 + empty_value: null 29 + final_key: final_value 30 + 31 + Test comments.yml roundtrip with JSON to verify parsed values 32 + 33 + $ yamlcat --json ../yaml/comments.yml 34 + {"name": "John Doe ", "age": "30 ", "address": {"street": "123 Main St ", "city": "Springfield", "zip": 12345}, "items": ["apple ", "banana", "cherry", "date "], "flow_seq": [1, 2, 3], "flow_map": {"key1": "value1", "key2": "value2"}, "nested": {"level1": {"level2": {"value": "deeply nested "}}}, "multi_comment_key": "value", "special": "value with # hash inside quotes", "empty_value": null, "final_key": "final_value"} 35 + 36 + Test full line comments are ignored 37 + 38 + $ echo '# This is a full line comment 39 + > name: Alice 40 + > # Another comment 41 + > age: 25' | yamlcat --json 42 + {"name": "Alice", "age": 25} 43 + 44 + Test end of line comments after scalars 45 + 46 + $ echo 'name: Bob # This is an end of line comment 47 + > age: 35 # Another end of line comment' | yamlcat --json 48 + {"name": "Bob ", "age": "35 "} 49 + 50 + Test comments after sequence items 51 + 52 + $ echo 'fruits: 53 + > - apple # First fruit 54 + > - banana # Second fruit 55 + > - cherry # Third fruit' | yamlcat --json 56 + {"fruits": ["apple ", "banana ", "cherry "]} 57 + 58 + Test comments between sequence items 59 + 60 + $ echo 'numbers: 61 + > - 1 62 + > # Comment between items 63 + > - 2 64 + > # Another comment 65 + > - 3' | yamlcat --json 66 + {"numbers": [1, 2, 3]} 67 + 68 + Test comments after flow sequences 69 + 70 + $ echo 'flow: [1, 2, 3] # Comment after flow sequence' | yamlcat --json 71 + {"flow": [1, 2, 3]} 72 + 73 + Test comments after flow mappings 74 + 75 + $ echo 'flow: {a: 1, b: 2} # Comment after flow mapping' | yamlcat --json 76 + {"flow": {"a": 1, "b": 2}} 77 + 78 + Test comments between mapping entries 79 + 80 + $ echo 'first: value1 81 + > # Comment between entries 82 + > second: value2 83 + > # Another comment 84 + > third: value3' | yamlcat --json 85 + {"first": "value1", "second": "value2", "third": "value3"} 86 + 87 + Test multiple consecutive comments 88 + 89 + $ echo '# First comment 90 + > # Second comment 91 + > # Third comment 92 + > key: value' | yamlcat --json 93 + {"key": "value"} 94 + 95 + Test comments in nested structures 96 + 97 + $ echo 'outer: 98 + > # Comment in nested level 99 + > inner: 100 + > # Comment in deeper level 101 + > key: value # End of line comment' | yamlcat --json 102 + {"outer": {"inner": {"key": "value "}}} 103 + 104 + Test comments with special characters 105 + 106 + $ echo '# Comment with !@#$%^&*() 107 + > key: value' | yamlcat --json 108 + {"key": "value"} 109 + 110 + Test that hash in quoted strings is not treated as comment 111 + 112 + $ echo 'text: "This # is not a comment" 113 + > other: '"'"'Also # not a comment'"'"'' | yamlcat --json 114 + {"text": "This # is not a comment", "other": "Also # not a comment"} 115 + 116 + Test comment before empty value (null) 117 + 118 + $ echo 'key: # Comment, value is null' | yamlcat --json 119 + {"key": null} 120 + 121 + Test comments at document start 122 + 123 + $ echo '# Comment at very start 124 + > # Another at start 125 + > data: value' | yamlcat --json 126 + {"data": "value"} 127 + 128 + Test comments at document end 129 + 130 + $ echo 'data: value 131 + > # Comment at end 132 + > # Another at end' | yamlcat --json 133 + {"data": "value"} 134 + 135 + Test comments with various indentation levels 136 + 137 + $ echo 'level1: 138 + > # Indented comment 139 + > level2: 140 + > # More indented comment 141 + > value: data' | yamlcat --json 142 + {"level1": {"level2": {"value": "data"}}} 143 + 144 + Test empty lines with comments 145 + 146 + $ echo 'first: 1 147 + > 148 + > # Comment after empty line 149 + > 150 + > second: 2' | yamlcat --json 151 + {"first": 1, "second": 2} 152 + 153 + Test comment after sequence with nested mapping 154 + 155 + $ echo 'items: 156 + > - name: item1 # Comment after nested value 157 + > value: 10 158 + > # Comment between sequence items 159 + > - name: item2 160 + > value: 20 # Another comment' | yamlcat --json 161 + {"items": [{"name": "item1 ", "value": 10}, {"name": "item2", "value": "20 "}]} 162 + 163 + Test comment only lines between complex structures 164 + 165 + $ echo 'mapping1: 166 + > key: value 167 + > # Comment between mappings 168 + > mapping2: 169 + > key: value' | yamlcat --json 170 + {"mapping1": {"key": "value"}, "mapping2": {"key": "value"}} 171 + 172 + Test comments do not affect block scalars 173 + 174 + $ echo 'literal: | 175 + > # This looks like a comment 176 + > but it is part of the literal text 177 + > key: value' | yamlcat --json 178 + {"literal": "# This looks like a comment\nbut it is part of the literal text\n", "key": "value"} 179 + 180 + Test comments do not affect folded scalars 181 + 182 + $ echo 'folded: > 183 + > # This also looks like a comment 184 + > but is part of folded text 185 + > key: value' | yamlcat --json 186 + {"folded": "# This also looks like a comment but is part of folded text\n", "key": "value"} 187 + 188 + Test whitespace preservation around comments 189 + 190 + $ echo 'key1: value1 # Comment with spaces' | yamlcat --json 191 + {"key1": "value1 "} 192 + 193 + Test comment after colon but before value 194 + 195 + $ echo 'key: # Comment before value 196 + > value' | yamlcat --json 197 + {"key": "value"}
+204
yaml/ocaml-yamle/tests/cram/documents.t
··· 1 + Test YAML directives and single document parsing 2 + 3 + This test suite covers YAML directives (%YAML, %TAG) and various single document formats. 4 + Multi-document streams are not yet supported and are not tested here. 5 + 6 + Test 1: Basic YAML 1.2 directive 7 + ==================================== 8 + 9 + $ yamlcat ../yaml/directives.yml 10 + version: '1.2' 11 + content: This document uses YAML 1.2 12 + 13 + Test 2: YAML 1.1 directive 14 + ==================================== 15 + 16 + $ yamlcat ../yaml/directives_yaml11.yml 17 + version: '1.1' 18 + content: This document uses YAML 1.1 19 + booleans: 20 + - true 21 + - false 22 + - true 23 + - false 24 + 25 + Test 3: TAG directive with custom prefix 26 + ==================================== 27 + 28 + $ yamlcat ../yaml/directives_tag.yml 29 + shape: 30 + radius: 5 31 + color: red 32 + point: 33 + x: 10 34 + y: 20 35 + 36 + Test 4: Multiple TAG directives 37 + ==================================== 38 + 39 + $ yamlcat ../yaml/directives_multiple_tags.yml 40 + user: 41 + name: Alice 42 + age: 30 43 + location: 44 + lat: 40.7128 45 + lon: -74.006 46 + config: 47 + debug: true 48 + timeout: 30 49 + 50 + Test 5: Implicit document (no markers) 51 + ==================================== 52 + 53 + $ yamlcat ../yaml/documents_single.yml 54 + key1: value1 55 + key2: value2 56 + nested: 57 + inner: data 58 + list: 59 + - item1 60 + - item2 61 + - item3 62 + 63 + Test 6: Explicit start marker (---) 64 + ==================================== 65 + 66 + $ yamlcat ../yaml/documents_single_explicit_start.yml 67 + key1: value1 68 + key2: value2 69 + nested: 70 + inner: data 71 + list: 72 + - item1 73 + - item2 74 + - item3 75 + 76 + Test 7: Explicit start and end markers (--- ... ) 77 + ==================================== 78 + 79 + $ yamlcat ../yaml/documents_single_explicit_both.yml 80 + key1: value1 81 + key2: value2 82 + nested: 83 + inner: data 84 + list: 85 + - item1 86 + - item2 87 + - item3 88 + 89 + Test 8: Document with YAML directive 90 + ==================================== 91 + 92 + $ yamlcat ../yaml/documents_single_with_directive.yml 93 + key1: value1 94 + key2: value2 95 + nested: 96 + inner: data 97 + list: 98 + - item1 99 + - item2 100 + - item3 101 + 102 + Test 9: Inline - implicit document (no markers) 103 + ==================================== 104 + 105 + $ echo 'name: John 106 + > age: 30 107 + > city: New York' | yamlcat 108 + name: John 109 + age: 30 110 + city: New York 111 + 112 + Test 10: Inline - explicit start marker 113 + ==================================== 114 + 115 + $ echo '--- 116 + > name: Jane 117 + > age: 25' | yamlcat 118 + name: Jane 119 + age: 25 120 + 121 + Test 11: Inline - explicit start and end markers 122 + ==================================== 123 + 124 + $ echo '--- 125 + > title: Example 126 + > content: data 127 + > ...' | yamlcat 128 + title: Example 129 + content: data 130 + 131 + Test 12: Inline - document with %YAML 1.2 directive 132 + ==================================== 133 + 134 + $ echo '%YAML 1.2 135 + > --- 136 + > version: 1.2 137 + > enabled: true' | yamlcat 138 + version: 1.2 139 + enabled: true 140 + 141 + Test 13: Inline - document with comment before content 142 + ==================================== 143 + 144 + $ echo '# This is a comment 145 + > name: Alice 146 + > # Another comment 147 + > value: 42' | yamlcat 148 + name: Alice 149 + value: 42 150 + 151 + Test 14: Inline - document with comment after directive 152 + ==================================== 153 + 154 + $ echo '%YAML 1.2 155 + > # Comment after directive 156 + > --- 157 + > key: value' | yamlcat 158 + key: value 159 + 160 + Test 15: Inline - explicit markers with comments 161 + ==================================== 162 + 163 + $ echo '--- # Document start 164 + > data: content 165 + > # Mid-document comment 166 + > more: values 167 + > ... # Document end' | yamlcat 168 + data: content 169 + more: values 170 + 171 + Test 16: Verify JSON roundtrip for directive file 172 + ==================================== 173 + 174 + $ yamlcat --json ../yaml/directives.yml 175 + {"version": "1.2", "content": "This document uses YAML 1.2"} 176 + 177 + Test 17: Verify JSON roundtrip for explicit markers 178 + ==================================== 179 + 180 + $ yamlcat --json ../yaml/documents_single_explicit_both.yml 181 + {"key1": "value1", "key2": "value2", "nested": {"inner": "data"}, "list": ["item1", "item2", "item3"]} 182 + 183 + Test 18: Empty document with explicit markers 184 + ==================================== 185 + 186 + $ echo '--- 187 + > ...' | yamlcat 188 + null 189 + 190 + Test 19: Document with only whitespace and markers 191 + ==================================== 192 + 193 + $ echo '--- 194 + > 195 + > ...' | yamlcat 196 + null 197 + 198 + Test 20: Directive followed by content without explicit start 199 + ==================================== 200 + 201 + $ echo '%YAML 1.2 202 + > simple: document' | yamlcat 203 + Error: expected document start '---' at line 2, columns 1-1 204 + [1]
+70
yaml/ocaml-yamle/tests/cram/failing_anchors.t
··· 1 + Anchor and Alias Support (currently not supported) 2 + 3 + These tests document anchor (&) and alias (*) support that is not yet 4 + implemented. Currently, aliases fail with "unresolved alias" error. 5 + 6 + Test: Simple scalar anchor and alias 7 + 8 + $ echo 'anchor: &anc value 9 + > alias: *anc' | yamlcat 2>&1 10 + Error: unresolved alias: *anc 11 + [1] 12 + 13 + Test: Numeric anchor and alias 14 + 15 + $ echo 'original: &num 42 16 + > copy: *num' | yamlcat 2>&1 17 + Error: unresolved alias: *num 18 + [1] 19 + 20 + Test: Sequence anchor and alias 21 + 22 + $ echo 'list: &items 23 + > - one 24 + > - two 25 + > copy: *items' | yamlcat 2>&1 26 + Error: unresolved alias: *items 27 + [1] 28 + 29 + Test: Mapping anchor and alias 30 + 31 + $ echo 'person: &p 32 + > name: Alice 33 + > age: 30 34 + > copy: *p' | yamlcat 2>&1 35 + Error: unresolved alias: *p 36 + [1] 37 + 38 + Test: Multiple aliases to same anchor 39 + 40 + $ echo 'value: &v 100 41 + > first: *v 42 + > second: *v 43 + > third: *v' | yamlcat 2>&1 44 + Error: unresolved alias: *v 45 + [1] 46 + 47 + Test: Anchor in flow context 48 + 49 + $ echo '[&item apple, *item]' | yamlcat 2>&1 50 + Error: unresolved alias: *item 51 + [1] 52 + 53 + Test: Anchor with mapping in flow 54 + 55 + $ echo '{original: &cfg {a: 1}, copy: *cfg}' | yamlcat 2>&1 56 + Error: unresolved alias: *cfg 57 + [1] 58 + 59 + Test: Anchors file from test suite 60 + 61 + $ yamlcat ../yaml/anchors_basic.yml 2>&1 62 + Error: multiple documents found when single expected 63 + [1] 64 + 65 + $ yamlcat ../yaml/anchors_merge.yml 2>&1 66 + Error: multiple documents found when single expected 67 + [1] 68 + 69 + Note: The anchor test files also use multiple documents, so they fail 70 + with multi-document errors before even hitting anchor issues.
+56
yaml/ocaml-yamle/tests/cram/failing_empty.t
··· 1 + Empty Collection YAML Emission (currently outputs nothing instead of [] or {}) 2 + 3 + These tests document the empty collection emission issue where empty 4 + sequences and mappings are emitted as nothing (interpreted as null) 5 + instead of [] or {} in YAML output. 6 + 7 + Note: JSON output correctly shows [] and {} for empty collections. 8 + The issue is only with YAML-format output. 9 + 10 + Test: Empty sequence emits as nothing instead of [] 11 + 12 + $ echo 'empty_seq: []' | yamlcat 13 + empty_seq: 14 + 15 + The above outputs just "empty_seq:" with nothing after it. 16 + Expected output should be: empty_seq: [] 17 + 18 + Test: Empty mapping emits as nothing instead of {} 19 + 20 + $ echo 'empty_map: {}' | yamlcat 21 + empty_map: 22 + 23 + Test: Multiple empty collections 24 + 25 + $ echo 'seq: [] 26 + > map: {} 27 + > data: value' | yamlcat 28 + seq: 29 + map: 30 + data: value 31 + 32 + Test: Nested empty collections 33 + 34 + $ echo 'outer: 35 + > inner_seq: [] 36 + > inner_map: {}' | yamlcat 37 + outer: 38 + inner_seq: 39 + inner_map: 40 + 41 + Test: Empty collection in sequence 42 + 43 + $ echo 'items: 44 + > - first 45 + > - [] 46 + > - third' | yamlcat 47 + items: 48 + - first 49 + - 50 + - third 51 + 52 + Test: Verify JSON output is correct (for comparison) 53 + 54 + $ echo 'empty_seq: [] 55 + > empty_map: {}' | yamlcat --json 56 + {"empty_seq": [], "empty_map": {}}
+45
yaml/ocaml-yamle/tests/cram/failing_escapes.t
··· 1 + Escape Sequence Issues (documentation of known edge cases) 2 + 3 + These tests document escape sequence handling edge cases. 4 + 5 + The primary issue is with \U (capital U) in double-quoted strings. 6 + In YAML, \U is a 32-bit unicode escape that expects 8 hex digits. 7 + When users write paths like "C:\Users" the \U is interpreted as 8 + a unicode escape but "sers" are not valid hex digits. 9 + 10 + Test: Capital U interpreted as unicode escape 11 + 12 + $ echo 'path: "C:\\Users\\Name"' | yamlcat --json 2>&1 13 + Error: invalid hex escape: at line 1, columns 12-12 14 + [1] 15 + 16 + This fails because: 17 + - Shell: echo 'C:\\Users\\Name' produces C:\Users\Name 18 + - YAML sees: "C:\Users\Name" 19 + - \U is a 32-bit unicode escape (expects \UHHHHHHHH) 20 + - "sers" are not 8 hex digits, so it fails 21 + 22 + Test: Lowercase u unicode escape works 23 + 24 + $ echo 'unicode: "\\u0041"' | yamlcat --json 25 + {"unicode": "A"} 26 + 27 + Test: Uppercase U requires 8 hex digits 28 + 29 + $ echo 'unicode: "\\U00000041"' | yamlcat --json 30 + {"unicode": "A"} 31 + 32 + Test: Backslash escaping works for non-unicode 33 + 34 + $ echo 'escaped: "one\\\\two\\\\three"' | yamlcat --json 35 + {"escaped": "one\\two\\three"} 36 + 37 + Test: Mixed valid escapes 38 + 39 + $ echo 'text: "Tab:\\t Newline:\\n Quote:\\\\"' | yamlcat --json 40 + {"text": "Tab:\t Newline:\n Quote:\\"} 41 + 42 + Test: Backslash a is bell character 43 + 44 + $ echo 'text: "test\\a"' | yamlcat --json 45 + {"text": "test\007"}
+73
yaml/ocaml-yamle/tests/cram/failing_multidoc.t
··· 1 + Multi-document stream support (currently not supported) 2 + 3 + These tests document expected behavior for multi-document YAML streams. 4 + They currently fail with "multiple documents found when single expected". 5 + 6 + Test: Two documents separated by --- 7 + 8 + $ echo '--- 9 + > first: document 10 + > --- 11 + > second: document' | yamlcat 2>&1 12 + Error: multiple documents found when single expected 13 + [1] 14 + 15 + Test: Three documents with different types 16 + 17 + $ echo '--- 18 + > mapping: value 19 + > --- 20 + > - sequence 21 + > - items 22 + > --- 23 + > scalar value' | yamlcat 2>&1 24 + Error: multiple documents found when single expected 25 + [1] 26 + 27 + Test: Documents with explicit end markers 28 + 29 + $ echo '--- 30 + > doc1: value 31 + > ... 32 + > --- 33 + > doc2: value 34 + > ...' | yamlcat 2>&1 35 + Error: multiple documents found when single expected 36 + [1] 37 + 38 + Test: Empty documents 39 + 40 + $ echo '--- 41 + > --- 42 + > content: here 43 + > ---' | yamlcat 2>&1 44 + Error: multiple documents found when single expected 45 + [1] 46 + 47 + Test: Multi-document file 48 + 49 + $ yamlcat ../yaml/documents_multi.yml 2>&1 50 + Error: multiple documents found when single expected 51 + [1] 52 + 53 + $ yamlcat ../yaml/documents_multi_three.yml 2>&1 54 + Error: multiple documents found when single expected 55 + [1] 56 + 57 + $ yamlcat ../yaml/documents_multi_with_end.yml 2>&1 58 + Error: multiple documents found when single expected 59 + [1] 60 + 61 + $ yamlcat ../yaml/documents_multi_empty.yml 2>&1 62 + Error: multiple documents found when single expected 63 + [1] 64 + 65 + Test: Anchors file (uses multiple documents) 66 + 67 + $ yamlcat ../yaml/anchors_basic.yml 2>&1 68 + Error: multiple documents found when single expected 69 + [1] 70 + 71 + $ yamlcat ../yaml/anchors_merge.yml 2>&1 72 + Error: multiple documents found when single expected 73 + [1]
+69
yaml/ocaml-yamle/tests/cram/failing_tags.t
··· 1 + Tag Shorthand Support (currently not supported) 2 + 3 + These tests document YAML tag shorthand (!!) support that is not yet 4 + implemented. Currently, tags are parsed as part of plain scalar content. 5 + 6 + Test: String tag shorthand 7 + 8 + $ echo '!!str 123' | yamlcat 9 + Error: invalid tag: !str 10 + [1] 11 + 12 + Expected: 123 (as a string) 13 + 14 + Test: Integer tag shorthand 15 + 16 + $ echo '!!int "42"' | yamlcat 17 + Error: invalid tag: !int 18 + [1] 19 + 20 + Expected: 42 21 + 22 + Test: Boolean tag shorthand 23 + 24 + $ echo '!!bool "yes"' | yamlcat 25 + Error: invalid tag: !bool 26 + [1] 27 + 28 + Expected: true 29 + 30 + Test: Null tag shorthand 31 + 32 + $ echo '!!null ""' | yamlcat 33 + Error: invalid tag: !null 34 + [1] 35 + 36 + Expected: null 37 + 38 + Test: Float tag shorthand 39 + 40 + $ echo '!!float 3.14' | yamlcat 41 + Error: invalid tag: !float 42 + [1] 43 + 44 + Expected: 3.14 45 + 46 + Test: Tag shorthand in mapping value 47 + 48 + $ echo 'value: !!str 42' | yamlcat 49 + Error: invalid tag: !str 50 + [1] 51 + 52 + Expected: value: "42" (string representation) 53 + 54 + Test: Local tags 55 + 56 + $ echo '!local_tag value' | yamlcat 57 + value 58 + 59 + Expected: value (with local tag applied) 60 + 61 + Test: Verbatim tags 62 + 63 + $ echo '!<tag:example.com:type> value' | yamlcat 64 + value 65 + 66 + Expected: value (with verbatim tag applied) 67 + 68 + Note: Tags are being parsed as literal text in the scalar value, 69 + with exclamation marks escaped in the output.
+471
yaml/ocaml-yamle/tests/cram/scalars.t
··· 1 + YAML Scalar Parsing Tests 2 + 3 + This file tests various forms of YAML scalar values including plain, quoted, and block scalars. 4 + 5 + ================================================================================ 6 + PLAIN SCALARS 7 + ================================================================================ 8 + 9 + Simple plain scalars 10 + 11 + $ echo 'key: value' | yamlcat 12 + key: value 13 + 14 + $ echo 'name: Alice 15 + > age: 30 16 + > active: true' | yamlcat 17 + name: Alice 18 + age: 30 19 + active: true 20 + 21 + Plain scalars with special values 22 + 23 + $ echo 'null_val: null 24 + > bool_true: true 25 + > bool_false: false 26 + > number: 42 27 + > float: 3.14' | yamlcat --json 28 + {"null_val": null, "bool_true": true, "bool_false": false, "number": 42, "float": 3.14} 29 + 30 + ================================================================================ 31 + QUOTED SCALARS - SINGLE QUOTES 32 + ================================================================================ 33 + 34 + Single-quoted strings preserve literal text 35 + 36 + $ echo "single: 'hello world'" | yamlcat 37 + single: hello world 38 + 39 + Single-quoted strings with embedded double quotes 40 + 41 + $ echo "quote: 'He said \"hello\"'" | yamlcat 42 + quote: "He said \"hello\"" 43 + 44 + Single-quoted strings with escaped single quotes (doubled) 45 + 46 + $ echo "escaped: 'It''s a test'" | yamlcat 47 + escaped: It's a test 48 + 49 + Single-quoted multiline (newlines become spaces) 50 + 51 + $ echo "text: 'This is a 52 + > multi-line 53 + > string'" | yamlcat --json 54 + {"text": "This is a multi-line string"} 55 + 56 + Empty single-quoted string 57 + 58 + $ echo "empty: ''" | yamlcat 59 + empty: '' 60 + 61 + ================================================================================ 62 + QUOTED SCALARS - DOUBLE QUOTES 63 + ================================================================================ 64 + 65 + Simple double-quoted strings 66 + 67 + $ echo 'double: "hello world"' | yamlcat 68 + double: hello world 69 + 70 + Double-quoted with escaped newline 71 + 72 + $ echo 'text: "Line one\nLine two"' | yamlcat --json 73 + {"text": "Line one Line two"} 74 + 75 + Double-quoted with escaped tab 76 + 77 + $ echo 'text: "Col1\tCol2\tCol3"' | yamlcat --json 78 + {"text": "Col1\tCol2\tCol3"} 79 + 80 + Double-quoted with backslash escape 81 + 82 + $ echo 'path: "C:\\Users\\Name"' | yamlcat --json 83 + Error: invalid hex escape: at line 1, columns 12-12 84 + [1] 85 + 86 + Double-quoted with escaped quote 87 + 88 + $ echo 'text: "She said \"hello\""' | yamlcat --json 89 + {"text": "She said \"hello\""} 90 + 91 + Double-quoted with multiple escape sequences 92 + 93 + $ echo 'text: "Tab:\t Newline:\n Quote:\" Backslash:\\\\"' | yamlcat --json 94 + {"text": "Tab:\t Newline: Quote:\" Backslash:\\"} 95 + 96 + Empty double-quoted string 97 + 98 + $ echo 'empty: ""' | yamlcat 99 + empty: '' 100 + 101 + ================================================================================ 102 + BLOCK SCALARS - LITERAL STYLE (|) 103 + ================================================================================ 104 + 105 + Basic literal block scalar (preserves newlines) 106 + 107 + $ echo 'text: | 108 + > line one 109 + > line two 110 + > line three' | yamlcat --json 111 + {"text": "line one\nline two\nline three\n"} 112 + 113 + Literal with indentation 114 + 115 + $ echo 'text: | 116 + > First line 117 + > Indented line 118 + > Back to first' | yamlcat --json 119 + {"text": "First line\n Indented line\nBack to first\n"} 120 + 121 + Literal with blank lines 122 + 123 + $ echo 'text: | 124 + > First paragraph 125 + > 126 + > Second paragraph' | yamlcat --json 127 + {"text": "First paragraph\n\nSecond paragraph\n"} 128 + 129 + ================================================================================ 130 + BLOCK SCALARS - FOLDED STYLE (>) 131 + ================================================================================ 132 + 133 + Basic folded block scalar (newlines become spaces) 134 + 135 + $ echo 'text: > 136 + > This is a long paragraph 137 + > that will be folded into 138 + > a single line.' | yamlcat --json 139 + {"text": "This is a long paragraph that will be folded into a single line.\n"} 140 + 141 + Folded with paragraph separation (blank line preserved) 142 + 143 + $ echo 'text: > 144 + > First paragraph 145 + > flows together. 146 + > 147 + > Second paragraph 148 + > also flows.' | yamlcat --json 149 + {"text": "First paragraph flows together.\nSecond paragraph also flows.\n"} 150 + 151 + ================================================================================ 152 + CHOMPING INDICATORS 153 + ================================================================================ 154 + 155 + Strip chomping (-) removes trailing newlines 156 + 157 + $ echo 'text: |- 158 + > No trailing newline' | yamlcat --json 159 + {"text": "No trailing newline"} 160 + 161 + $ echo 'text: |- 162 + > Text here 163 + > 164 + > ' | yamlcat --json 165 + {"text": "Text here"} 166 + 167 + Folded with strip 168 + 169 + $ echo 'text: >- 170 + > Folded text 171 + > with stripped 172 + > trailing newlines 173 + > 174 + > ' | yamlcat --json 175 + {"text": "Folded text with stripped trailing newlines"} 176 + 177 + Clip chomping (default) keeps single trailing newline 178 + 179 + $ echo 'text: | 180 + > One trailing newline 181 + > 182 + > ' | yamlcat --json 183 + {"text": "One trailing newline\n"} 184 + 185 + $ echo 'text: > 186 + > Folded with one 187 + > trailing newline 188 + > 189 + > ' | yamlcat --json 190 + {"text": "Folded with one trailing newline\n"} 191 + 192 + Keep chomping (+) preserves all trailing newlines 193 + 194 + $ echo 'text: |+ 195 + > Keeps trailing newlines 196 + > 197 + > 198 + > ' | yamlcat --json 199 + {"text": "Keeps trailing newlines\n\n\n\n"} 200 + 201 + $ echo 'text: >+ 202 + > Folded text 203 + > keeps trailing 204 + > 205 + > 206 + > ' | yamlcat --json 207 + {"text": "Folded text keeps trailing\n\n\n\n"} 208 + 209 + ================================================================================ 210 + EXPLICIT INDENTATION INDICATORS 211 + ================================================================================ 212 + 213 + Literal with explicit 2-space indentation 214 + 215 + $ echo 'text: |2 216 + > Two space base 217 + > Second line 218 + > Extra indent' | yamlcat --json 219 + {"text": " Two space base\n Second line\n Extra indent\n"} 220 + 221 + Folded with explicit indentation 222 + 223 + $ echo 'text: >2 224 + > Text with two space 225 + > base indentation that 226 + > will be folded.' | yamlcat --json 227 + {"text": "Text with two space base indentation that will be folded.\n"} 228 + 229 + Combined indentation and chomping indicators 230 + 231 + $ echo 'text: |2- 232 + > Indented by 2 233 + > No trailing newlines 234 + > 235 + > ' | yamlcat --json 236 + {"text": " Indented by 2\n No trailing newlines"} 237 + 238 + $ echo 'text: |2+ 239 + > Indented by 2 240 + > Keeps trailing newlines 241 + > 242 + > 243 + > ' | yamlcat --json 244 + {"text": " Indented by 2\n Keeps trailing newlines\n\n\n\n"} 245 + 246 + ================================================================================ 247 + FILE TESTS - QUOTED SCALARS 248 + ================================================================================ 249 + 250 + Test parsing scalars_quoted.yml file 251 + 252 + $ yamlcat ../yaml/scalars_quoted.yml | head -20 253 + single_simple: hello world 254 + single_with_double: "He said \"hello\"" 255 + single_escaped_quote: 'It''s a single quote: ''example''' 256 + single_multiline: This is a multi-line single quoted string 257 + double_simple: hello world 258 + double_with_single: It's easy 259 + double_escaped_quote: "She said \"hello\"" 260 + escaped_newline: "Line one\nLine two\nLine three" 261 + escaped_tab: "Column1\tColumn2\tColumn3" 262 + escaped_backslash: "Path: C:\\Users\\Name" 263 + escaped_carriage: "Before\rAfter" 264 + escaped_bell: "Bell\x07" 265 + escaped_backspace: "Back\x08" 266 + escaped_formfeed: "Form\x0c" 267 + escaped_vertical: "Vertical\x0btab" 268 + unicode_16bit: 'Snowman: ☃' 269 + unicode_32bit: 'Emoji: 😀' 270 + unicode_hex: "Null byte: \x00" 271 + empty_single: '' 272 + empty_double: '' 273 + 274 + Test JSON output for quoted scalars 275 + 276 + $ yamlcat --json ../yaml/scalars_quoted.yml | head -c 500 277 + {"single_simple": "hello world", "single_with_double": "He said \"hello\"", "single_escaped_quote": "It's a single quote: 'example'", "single_multiline": "This is a multi-line single quoted string", "double_simple": "hello world", "double_with_single": "It's easy", "double_escaped_quote": "She said \"hello\"", "escaped_newline": "Line one\nLine two\nLine three", "escaped_tab": "Column1\tColumn2\tColumn3", "escaped_backslash": "Path: C:\\Users\\Name", "escaped_carriage": "Before\rAfter", "escaped 278 + 279 + Verify specific escape handling in JSON 280 + 281 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"escaped_newline": "[^"]*"' 282 + "escaped_newline": "Line one\nLine two\nLine three" 283 + 284 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"escaped_tab": "[^"]*"' 285 + "escaped_tab": "Column1\tColumn2\tColumn3" 286 + 287 + Verify Unicode handling 288 + 289 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"unicode_16bit": "[^"]*"' 290 + "unicode_16bit": "Snowman: \226\152\131" 291 + 292 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"unicode_32bit": "[^"]*"' 293 + "unicode_32bit": "Emoji: \240\159\152\128" 294 + 295 + Verify quoted strings preserve type indicators 296 + 297 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"string_true": "[^"]*"' 298 + "string_true": "true" 299 + 300 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"string_null": "[^"]*"' 301 + "string_null": "null" 302 + 303 + $ yamlcat --json ../yaml/scalars_quoted.yml | grep -o '"string_number": "[^"]*"' 304 + "string_number": "123" 305 + 306 + ================================================================================ 307 + FILE TESTS - BLOCK SCALARS 308 + ================================================================================ 309 + 310 + Test parsing scalars_block.yml file 311 + 312 + $ yamlcat ../yaml/scalars_block.yml | head -30 313 + literal_basic: "Line one\nLine two\nLine three\n" 314 + literal_with_indent: "First line\n Indented line\n More indented\n Back to second level\nBack to first level\n" 315 + folded_basic: "This is a long paragraph that will be folded into a single line with the newlines converted to spaces.\n" 316 + folded_paragraph: "First paragraph flows together into a single line.\nSecond paragraph after blank line also flows together.\n" 317 + literal_strip: No trailing newline 318 + literal_strip_multiple: Text here 319 + folded_strip: Folded text with stripped trailing newlines 320 + literal_clip: "One trailing newline\n" 321 + literal_clip_explicit: "This is the default behavior\n" 322 + folded_clip: "Folded with one trailing newline\n" 323 + literal_keep: "Keeps trailing newlines\n\n\n" 324 + literal_keep_multiple: "Text here\n\n\n" 325 + folded_keep: "Folded text keeps trailing\n\n\n" 326 + literal_indent_2: " Two space indentation\n is preserved here\n Extra indent\n Back to two\n" 327 + literal_indent_4: " Four space base indent\n Second line\n Extra indent\n Back to base\n" 328 + folded_indent_2: "Text with two space base indentation that will be folded.\n" 329 + folded_indent_3: "Three space indent for this folded text block.\n" 330 + literal_indent_strip: " Indented by 2\n No trailing newlines" 331 + folded_indent_strip: Folded with indent and stripped end 332 + literal_indent_keep: " Indented by 2\n Keeps trailing newlines\n\n\n" 333 + folded_indent_keep: "Folded indent 4 keeps all trailing\n\n\n" 334 + empty_literal: "\nempty_folded: >\n\n# Block scalar with only newlines\nonly_newlines_literal: |\n\n\nonly_newlines_folded: >\n\n\n# Complex indentation patterns\ncomplex_literal: |\nFirst level\n Second level\n Third level\n Back to second\nBack to first\n\nNew paragraph\n With indent\n\nFinal paragraph\n" 335 + complex_folded: "This paragraph flows together.\nThis is separate. This line starts more indented and continues.\nFinal thoughts here.\n" 336 + special_chars_literal: "Special: @#$%^&*()\nQuotes: \"double\" 'single'\nBrackets: [array] {object}\nSymbols: | > & * ? : -\n" 337 + special_chars_folded: "All special chars are literal in block scalars: []{}|>*&\n" 338 + sequence_with_blocks: 339 + - "First item\nliteral block\n" 340 + - "Second item folded block\n" 341 + - "Third item\nstripped" 342 + - "Fourth item\nkept\n\n\n" 343 + 344 + Test JSON output for block scalars 345 + 346 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"literal_basic": "[^"]*"' 347 + "literal_basic": "Line one\nLine two\nLine three\n" 348 + 349 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"folded_basic": "[^"]*"' | head -c 100 350 + "folded_basic": "This is a long paragraph that will be folded into a single line with the newlines c 351 + 352 + Verify strip chomping 353 + 354 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"literal_strip": "[^"]*"' 355 + "literal_strip": "No trailing newline" 356 + 357 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"folded_strip": "[^"]*"' 358 + "folded_strip": "Folded text with stripped trailing newlines" 359 + 360 + Verify clip chomping (single newline) 361 + 362 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"literal_clip": "[^"]*"' 363 + "literal_clip": "One trailing newline\n" 364 + 365 + Verify keep chomping (all newlines) 366 + 367 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"literal_keep": "[^"]*"' 368 + "literal_keep": "Keeps trailing newlines\n\n\n" 369 + 370 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"folded_keep": "[^"]*"' 371 + "folded_keep": "Folded text keeps trailing\n\n\n" 372 + 373 + Verify indentation handling 374 + 375 + $ yamlcat --json ../yaml/scalars_block.yml | grep -o '"literal_indent_2": "[^"]*"' 376 + "literal_indent_2": " Two space indentation\n is preserved here\n Extra indent\n Back to two\n" 377 + 378 + Verify nested structures with block scalars 379 + 380 + $ yamlcat ../yaml/scalars_block.yml | tail -10 381 + special_chars_folded: "All special chars are literal in block scalars: []{}|>*&\n" 382 + sequence_with_blocks: 383 + - "First item\nliteral block\n" 384 + - "Second item folded block\n" 385 + - "Third item\nstripped" 386 + - "Fourth item\nkept\n\n\n" 387 + nested: 388 + description: "This is a folded description that spans multiple lines.\n" 389 + code: "def hello():\n print(\"Hello, World!\")\n return True\n" 390 + notes: "Final notes\nwith stripped end" 391 + 392 + ================================================================================ 393 + SPECIAL CASES AND EDGE CASES 394 + ================================================================================ 395 + 396 + Empty block scalars 397 + 398 + $ echo 'empty_literal: |' | yamlcat --json 399 + {"empty_literal": ""} 400 + 401 + $ echo 'empty_folded: >' | yamlcat --json 402 + {"empty_folded": ""} 403 + 404 + Block scalars with special characters (no escaping needed) 405 + 406 + $ echo 'code: | 407 + > Special: @#$%^&*() 408 + > Quotes: "double" '"'"'single'"'"' 409 + > Brackets: [array] {object}' | yamlcat --json 410 + {"code": "Special: @#$%^&*()\nQuotes: \"double\" 'single'\nBrackets: [array] {object}\n"} 411 + 412 + Plain scalar vs quoted string for special values 413 + 414 + $ echo 'unquoted_true: true 415 + > quoted_true: "true"' | yamlcat --json 416 + {"unquoted_true": true, "quoted_true": "true"} 417 + 418 + $ echo 'unquoted_null: null 419 + > quoted_null: "null"' | yamlcat --json 420 + {"unquoted_null": null, "quoted_null": "null"} 421 + 422 + Strings that need quoting to preserve leading/trailing spaces 423 + 424 + $ echo 'leading: " spaces" 425 + > trailing: "spaces " 426 + > both: " spaces "' | yamlcat --json 427 + {"leading": " spaces", "trailing": "spaces ", "both": " spaces "} 428 + 429 + Block scalars in sequences 430 + 431 + $ echo 'items: 432 + > - | 433 + > First item 434 + > multiline 435 + > - > 436 + > Second item 437 + > folded' | yamlcat --json 438 + {"items": ["First item\nmultiline\n", "Second item folded\n"]} 439 + 440 + Block scalars in nested mappings 441 + 442 + $ echo 'outer: 443 + > inner: 444 + > description: > 445 + > This is a folded 446 + > description. 447 + > code: | 448 + > def test(): 449 + > return True' | yamlcat --json 450 + {"outer": {"inner": {"description": "This is a folded description.\n", "code": "def test():\n return True\n"}}} 451 + 452 + Preserving indentation in literal blocks 453 + 454 + $ echo 'code: | 455 + > def hello(): 456 + > print("Hello") 457 + > if True: 458 + > return 42' | yamlcat --json 459 + {"code": "def hello():\n print(\"Hello\")\n if True:\n return 42\n"} 460 + 461 + Folded scalars preserve more-indented lines 462 + 463 + $ echo 'text: > 464 + > Normal paragraph 465 + > continues here. 466 + > 467 + > Indented block 468 + > preserved. 469 + > 470 + > Back to normal.' | yamlcat --json 471 + {"text": "Normal paragraph continues here.\nIndented block preserved.\nBack to normal.\n"}
+444
yaml/ocaml-yamle/tests/cram/values.t
··· 1 + Test YAML null values from values_null.yml 2 + 3 + $ yamlcat ../yaml/values_null.yml 4 + explicit_null: null 5 + tilde_null: null 6 + empty_null: null 7 + flow_null: 8 + - null 9 + - null 10 + - null 11 + sequence_nulls: 12 + - null 13 + - null 14 + - null 15 + - explicit: null 16 + - tilde: null 17 + - empty: null 18 + mapping_nulls: 19 + key1: null 20 + key2: null 21 + key3: null 22 + "null": null key with string value 23 + "~": tilde key with string value 24 + nested: 25 + level1: 26 + null_value: null 27 + tilde_value: null 28 + empty_value: null 29 + list: 30 + - null 31 + - null 32 + - null 33 + - some_value 34 + map: 35 + a: null 36 + b: null 37 + c: null 38 + string_nulls: 39 + quoted_null: 'null' 40 + quoted_tilde: '~' 41 + null_in_string: this is null 42 + word_null: 'null' 43 + 44 + $ yamlcat --json ../yaml/values_null.yml 45 + {"explicit_null": null, "tilde_null": null, "empty_null": null, "flow_null": [null, null, null], "sequence_nulls": [null, null, null, {"explicit": null}, {"tilde": null}, {"empty": null}], "mapping_nulls": {"key1": null, "key2": null, "key3": null}, "null": "null key with string value", "~": "tilde key with string value", "nested": {"level1": {"null_value": null, "tilde_value": null, "empty_value": null, "list": [null, null, null, "some_value"], "map": {"a": null, "b": null, "c": null}}}, "string_nulls": {"quoted_null": "null", "quoted_tilde": "~", "null_in_string": "this is null", "word_null": "null"}} 46 + 47 + Test YAML boolean values from values_bool.yml 48 + 49 + $ yamlcat ../yaml/values_bool.yml 50 + bool_true: true 51 + bool_false: false 52 + capitalized_true: true 53 + capitalized_false: false 54 + yes_value: true 55 + no_value: false 56 + Yes_value: true 57 + No_value: false 58 + YES_value: true 59 + NO_value: false 60 + on_value: true 61 + off_value: false 62 + On_value: true 63 + Off_value: false 64 + ON_value: true 65 + OFF_value: false 66 + bool_sequence: 67 + - true 68 + - false 69 + - true 70 + - false 71 + - true 72 + - false 73 + flow_bools: 74 + - true 75 + - false 76 + - true 77 + - false 78 + bool_mapping: 79 + active: true 80 + disabled: false 81 + enabled: true 82 + stopped: false 83 + quoted_bools: 84 + quoted_true: 'true' 85 + quoted_false: 'false' 86 + quoted_yes: 'yes' 87 + quoted_no: 'no' 88 + single_true: 'true' 89 + single_false: 'false' 90 + nested_bools: 91 + settings: 92 + debug: true 93 + verbose: false 94 + legacy_yes: true 95 + legacy_no: false 96 + flags: 97 + - true 98 + - false 99 + - true 100 + - false 101 + mixed_case: 102 + "TRUE": true 103 + "FALSE": false 104 + "TrUe": true 105 + "FaLsE": false 106 + bool_like_strings: 107 + truthy: truely 108 + falsy: falsetto 109 + yes_sir: yessir 110 + no_way: noway 111 + 112 + $ yamlcat --json ../yaml/values_bool.yml 113 + {"bool_true": true, "bool_false": false, "capitalized_true": true, "capitalized_false": false, "yes_value": true, "no_value": false, "Yes_value": true, "No_value": false, "YES_value": true, "NO_value": false, "on_value": true, "off_value": false, "On_value": true, "Off_value": false, "ON_value": true, "OFF_value": false, "bool_sequence": [true, false, true, false, true, false], "flow_bools": [true, false, true, false], "bool_mapping": {"active": true, "disabled": false, "enabled": true, "stopped": false}, "quoted_bools": {"quoted_true": "true", "quoted_false": "false", "quoted_yes": "yes", "quoted_no": "no", "single_true": "true", "single_false": "false"}, "nested_bools": {"settings": {"debug": true, "verbose": false, "legacy_yes": true, "legacy_no": false}, "flags": [true, false, true, false]}, "mixed_case": {"TRUE": true, "FALSE": false, "TrUe": true, "FaLsE": false}, "bool_like_strings": {"truthy": "truely", "falsy": "falsetto", "yes_sir": "yessir", "no_way": "noway"}} 114 + 115 + Test YAML number values from values_numbers.yml 116 + 117 + $ yamlcat ../yaml/values_numbers.yml 118 + int_zero: 0 119 + int_positive: 42 120 + int_negative: -17 121 + int_large: 1000000 122 + int_with_underscores: 1000000 123 + octal_value: 12 124 + octal_zero: 0 125 + octal_large: 511 126 + hex_lowercase: 26 127 + hex_uppercase: 26 128 + hex_mixed: 3735928559 129 + hex_zero: 0 130 + float_simple: 3.14 131 + float_negative: -0.5 132 + float_zero: 0 133 + float_leading_dot: 0.5 134 + float_trailing_zero: 1 135 + scientific_positive: 10000000000 136 + scientific_negative: 0.0015 137 + scientific_uppercase: 250 138 + scientific_no_sign: 300000 139 + positive_infinity: .inf 140 + negative_infinity: -.inf 141 + not_a_number: .nan 142 + infinity_upper: .inf 143 + infinity_caps: .inf 144 + nan_upper: .nan 145 + nan_caps: .nan 146 + number_sequence: 147 + - 0 148 + - 42 149 + - -17 150 + - 3.14 151 + - 10000000000 152 + - .inf 153 + - .nan 154 + flow_numbers: 155 + - 0 156 + - 42 157 + - -17 158 + - 3.14 159 + - 26 160 + - 12 161 + number_mapping: 162 + count: 100 163 + price: 19.99 164 + discount: -5 165 + hex_color: 16734003 166 + octal_perms: 493 167 + scientific: 6.022e+23 168 + quoted_numbers: 169 + string_int: '42' 170 + string_float: '3.14' 171 + string_hex: '0x1A' 172 + string_octal: 0o14 173 + string_inf: '.inf' 174 + string_nan: '.nan' 175 + numeric_strings: 176 + phone: 555-1234 177 + version: 1.2.3 178 + code: 123 179 + leading_zero: 7 180 + plus_sign: 123 181 + edge_cases: 182 + min_int: -9.22337e+18 183 + max_int: 9.22337e+18 184 + very_small: 1e-100 185 + very_large: 1e+100 186 + negative_zero: -0 187 + positive_zero: 0 188 + nested_numbers: 189 + coordinates: 190 + x: 10.5 191 + y: -20.3 192 + z: 0 193 + measurements: 194 + - 1.1 195 + - 2.2 196 + - 3.3 197 + stats: 198 + count: 1000 199 + average: 45.67 200 + max: .inf 201 + min: -.inf 202 + legacy_octal: 14 203 + binary_like: 10 204 + format_tests: 205 + no_decimal: 42 206 + with_decimal: 42 207 + leading_zero_decimal: 0.42 208 + no_leading_digit: 0.42 209 + trailing_decimal: 42 210 + 211 + $ yamlcat --json ../yaml/values_numbers.yml 212 + {"int_zero": 0, "int_positive": 42, "int_negative": -17, "int_large": 1000000, "int_with_underscores": 1000000, "octal_value": 12, "octal_zero": 0, "octal_large": 511, "hex_lowercase": 26, "hex_uppercase": 26, "hex_mixed": 3735928559, "hex_zero": 0, "float_simple": 3.14, "float_negative": -0.5, "float_zero": 0, "float_leading_dot": 0.5, "float_trailing_zero": 1, "scientific_positive": 10000000000, "scientific_negative": 0.0015, "scientific_uppercase": 250, "scientific_no_sign": 300000, "positive_infinity": inf, "negative_infinity": -inf, "not_a_number": nan, "infinity_upper": inf, "infinity_caps": inf, "nan_upper": nan, "nan_caps": nan, "number_sequence": [0, 42, -17, 3.14, 10000000000, inf, nan], "flow_numbers": [0, 42, -17, 3.14, 26, 12], "number_mapping": {"count": 100, "price": 19.99, "discount": -5, "hex_color": 16734003, "octal_perms": 493, "scientific": 6.022e+23}, "quoted_numbers": {"string_int": "42", "string_float": "3.14", "string_hex": "0x1A", "string_octal": "0o14", "string_inf": ".inf", "string_nan": ".nan"}, "numeric_strings": {"phone": "555-1234", "version": "1.2.3", "code": 123, "leading_zero": 7, "plus_sign": 123}, "edge_cases": {"min_int": -9.22337e+18, "max_int": 9.22337e+18, "very_small": 1e-100, "very_large": 1e+100, "negative_zero": -0, "positive_zero": 0}, "nested_numbers": {"coordinates": {"x": 10.5, "y": -20.3, "z": 0}, "measurements": [1.1, 2.2, 3.3], "stats": {"count": 1000, "average": 45.67, "max": inf, "min": -inf}}, "legacy_octal": 14, "binary_like": 10, "format_tests": {"no_decimal": 42, "with_decimal": 42, "leading_zero_decimal": 0.42, "no_leading_digit": 0.42, "trailing_decimal": 42}} 213 + 214 + Test YAML timestamp values from values_timestamps.yml 215 + 216 + $ yamlcat ../yaml/values_timestamps.yml 217 + date_simple: 2001-12-15 218 + date_earliest: 1970-01-01 219 + date_leap_year: 2020-02-29 220 + date_current: 2025-12-04 221 + datetime_utc: '2001-12-15T02:59:43.1Z' 222 + datetime_utc_full: '2001-12-15T02:59:43.123456Z' 223 + datetime_utc_no_frac: '2001-12-15T02:59:43Z' 224 + datetime_offset_pos: '2001-12-15T02:59:43.1+05:30' 225 + datetime_offset_neg: '2001-12-15T02:59:43.1-05:00' 226 + datetime_offset_hours: '2001-12-15T02:59:43+05' 227 + datetime_spaced: '2001-12-14 21:59:43.10 -5' 228 + datetime_spaced_utc: '2001-12-15 02:59:43.1 Z' 229 + datetime_spaced_offset: '2001-12-14 21:59:43.10 -05:00' 230 + datetime_no_frac: '2001-12-15T14:30:00Z' 231 + date_only: 2001-12-15 232 + timestamp_formats: 233 + iso_date: 2001-12-15 234 + iso_datetime_z: '2001-12-15T02:59:43Z' 235 + iso_datetime_offset: '2001-12-15T02:59:43+00:00' 236 + spaced_datetime: '2001-12-14 21:59:43.10 -5' 237 + canonical: '2001-12-15T02:59:43.1Z' 238 + timestamp_sequence: 239 + - 2001-12-15 240 + - '2001-12-15T02:59:43.1Z' 241 + - '2001-12-14 21:59:43.10 -5' 242 + - '2025-01-01T00:00:00Z' 243 + events: 244 + created: '2001-12-15T02:59:43.1Z' 245 + modified: '2001-12-16T10:30:00Z' 246 + published: '2001-12-14 21:59:43.10 -5' 247 + quoted_timestamps: 248 + string_date: 2001-12-15 249 + string_datetime: '2001-12-15T02:59:43.1Z' 250 + string_spaced: '2001-12-14 21:59:43.10 -5' 251 + edge_cases: 252 + midnight: '2001-12-15T00:00:00Z' 253 + end_of_day: '2001-12-15T23:59:59Z' 254 + microseconds: '2001-12-15T02:59:43.123456Z' 255 + no_seconds: '2001-12-15T02:59Z' 256 + hour_only: 2001-12-15T02Z 257 + nested_timestamps: 258 + project: 259 + start_date: 2001-12-15 260 + milestones: 261 + - date: 2001-12-20 262 + time: '2001-12-20T14:00:00Z' 263 + - date: 2002-01-15 264 + time: '2002-01-15T09:30:00-05:00' 265 + metadata: 266 + created: '2001-12-14 21:59:43.10 -5' 267 + updated: '2001-12-15T02:59:43.1Z' 268 + invalid_timestamps: 269 + bad_date: 2001-13-45 270 + bad_time: '2001-12-15T25:99:99Z' 271 + incomplete: 2001-12 272 + no_leading_zero: 2001-1-5 273 + timezones: 274 + utc_z: '2001-12-15T02:59:43Z' 275 + utc_offset: '2001-12-15T02:59:43+00:00' 276 + est: '2001-12-14T21:59:43-05:00' 277 + ist: '2001-12-15T08:29:43+05:30' 278 + jst: '2001-12-15T11:59:43+09:00' 279 + date_range: 280 + past: 1900-01-01 281 + unix_epoch: '1970-01-01T00:00:00Z' 282 + y2k: '2000-01-01T00:00:00Z' 283 + present: 2025-12-04 284 + future: '2099-12-31T23:59:59Z' 285 + 286 + $ yamlcat --json ../yaml/values_timestamps.yml 287 + {"date_simple": "2001-12-15", "date_earliest": "1970-01-01", "date_leap_year": "2020-02-29", "date_current": "2025-12-04", "datetime_utc": "2001-12-15T02:59:43.1Z", "datetime_utc_full": "2001-12-15T02:59:43.123456Z", "datetime_utc_no_frac": "2001-12-15T02:59:43Z", "datetime_offset_pos": "2001-12-15T02:59:43.1+05:30", "datetime_offset_neg": "2001-12-15T02:59:43.1-05:00", "datetime_offset_hours": "2001-12-15T02:59:43+05", "datetime_spaced": "2001-12-14 21:59:43.10 -5", "datetime_spaced_utc": "2001-12-15 02:59:43.1 Z", "datetime_spaced_offset": "2001-12-14 21:59:43.10 -05:00", "datetime_no_frac": "2001-12-15T14:30:00Z", "date_only": "2001-12-15", "timestamp_formats": {"iso_date": "2001-12-15", "iso_datetime_z": "2001-12-15T02:59:43Z", "iso_datetime_offset": "2001-12-15T02:59:43+00:00", "spaced_datetime": "2001-12-14 21:59:43.10 -5", "canonical": "2001-12-15T02:59:43.1Z"}, "timestamp_sequence": ["2001-12-15", "2001-12-15T02:59:43.1Z", "2001-12-14 21:59:43.10 -5", "2025-01-01T00:00:00Z"], "events": {"created": "2001-12-15T02:59:43.1Z", "modified": "2001-12-16T10:30:00Z", "published": "2001-12-14 21:59:43.10 -5"}, "quoted_timestamps": {"string_date": "2001-12-15", "string_datetime": "2001-12-15T02:59:43.1Z", "string_spaced": "2001-12-14 21:59:43.10 -5"}, "edge_cases": {"midnight": "2001-12-15T00:00:00Z", "end_of_day": "2001-12-15T23:59:59Z", "microseconds": "2001-12-15T02:59:43.123456Z", "no_seconds": "2001-12-15T02:59Z", "hour_only": "2001-12-15T02Z"}, "nested_timestamps": {"project": {"start_date": "2001-12-15", "milestones": [{"date": "2001-12-20", "time": "2001-12-20T14:00:00Z"}, {"date": "2002-01-15", "time": "2002-01-15T09:30:00-05:00"}], "metadata": {"created": "2001-12-14 21:59:43.10 -5", "updated": "2001-12-15T02:59:43.1Z"}}}, "invalid_timestamps": {"bad_date": "2001-13-45", "bad_time": "2001-12-15T25:99:99Z", "incomplete": "2001-12", "no_leading_zero": "2001-1-5"}, "timezones": {"utc_z": "2001-12-15T02:59:43Z", "utc_offset": "2001-12-15T02:59:43+00:00", "est": "2001-12-14T21:59:43-05:00", "ist": "2001-12-15T08:29:43+05:30", "jst": "2001-12-15T11:59:43+09:00"}, "date_range": {"past": "1900-01-01", "unix_epoch": "1970-01-01T00:00:00Z", "y2k": "2000-01-01T00:00:00Z", "present": "2025-12-04", "future": "2099-12-31T23:59:59Z"}} 288 + 289 + Test inline null values 290 + 291 + $ echo 'explicit: null' | yamlcat --json 292 + {"explicit": null} 293 + 294 + $ echo 'tilde: ~' | yamlcat --json 295 + {"tilde": null} 296 + 297 + $ echo 'empty:' | yamlcat --json 298 + {"empty": null} 299 + 300 + $ echo '[null, ~, ]' | yamlcat --json 301 + [null, null, null] 302 + 303 + Test inline boolean values 304 + 305 + $ echo 'bool: true' | yamlcat --json 306 + {"bool": true} 307 + 308 + $ echo 'bool: false' | yamlcat --json 309 + {"bool": false} 310 + 311 + $ echo '[true, false]' | yamlcat --json 312 + [true, false] 313 + 314 + Test inline integer values 315 + 316 + $ echo 'positive: 42' | yamlcat --json 317 + {"positive": 42} 318 + 319 + $ echo 'negative: -17' | yamlcat --json 320 + {"negative": -17} 321 + 322 + $ echo 'zero: 0' | yamlcat --json 323 + {"zero": 0} 324 + 325 + $ echo '[0, 42, -17]' | yamlcat --json 326 + [0, 42, -17] 327 + 328 + Test inline float values 329 + 330 + $ echo 'simple: 3.14' | yamlcat --json 331 + {"simple": 3.14} 332 + 333 + $ echo 'negative: -0.5' | yamlcat --json 334 + {"negative": -0.5} 335 + 336 + $ echo 'leading_dot: .5' | yamlcat --json 337 + {"leading_dot": 0.5} 338 + 339 + $ echo '[3.14, -0.5, 0.0]' | yamlcat --json 340 + [3.14, -0.5, 0] 341 + 342 + Test scientific notation 343 + 344 + $ echo 'positive_exp: 1.5e10' | yamlcat --json 345 + {"positive_exp": 15000000000} 346 + 347 + $ echo 'negative_exp: 1.5e-3' | yamlcat --json 348 + {"negative_exp": 0.0015} 349 + 350 + $ echo 'uppercase: 2.5E+2' | yamlcat --json 351 + {"uppercase": 250} 352 + 353 + Test special float values 354 + 355 + $ echo 'pos_inf: .inf' | yamlcat --json 356 + {"pos_inf": inf} 357 + 358 + $ echo 'neg_inf: -.inf' | yamlcat --json 359 + {"neg_inf": -inf} 360 + 361 + $ echo 'not_a_num: .nan' | yamlcat --json 362 + {"not_a_num": nan} 363 + 364 + $ echo '[.inf, -.inf, .nan]' | yamlcat --json 365 + [inf, -inf, nan] 366 + 367 + Test hexadecimal numbers 368 + 369 + $ echo 'hex_lower: 0x1a' | yamlcat --json 370 + {"hex_lower": 26} 371 + 372 + $ echo 'hex_upper: 0x1A' | yamlcat --json 373 + {"hex_upper": 26} 374 + 375 + $ echo 'hex_mixed: 0xDeadBeef' | yamlcat --json 376 + {"hex_mixed": 3735928559} 377 + 378 + Test octal numbers 379 + 380 + $ echo 'octal: 0o17' | yamlcat --json 381 + {"octal": 15} 382 + 383 + $ echo 'octal_zero: 0o0' | yamlcat --json 384 + {"octal_zero": 0} 385 + 386 + $ echo 'octal_large: 0o755' | yamlcat --json 387 + {"octal_large": 493} 388 + 389 + Test mixed special values 390 + 391 + $ echo 'null: null 392 + > bool: true 393 + > int: 42 394 + > float: 3.14 395 + > sci: 1.5e10' | yamlcat --json 396 + {"null": null, "bool": true, "int": 42, "float": 3.14, "sci": 15000000000} 397 + 398 + Test quoted vs unquoted special values 399 + 400 + $ echo 'unquoted_null: null 401 + > quoted_null: "null"' | yamlcat --json 402 + {"unquoted_null": null, "quoted_null": "null"} 403 + 404 + $ echo 'unquoted_bool: true 405 + > quoted_bool: "true"' | yamlcat --json 406 + {"unquoted_bool": true, "quoted_bool": "true"} 407 + 408 + $ echo 'unquoted_num: 42 409 + > quoted_num: "42"' | yamlcat --json 410 + {"unquoted_num": 42, "quoted_num": "42"} 411 + 412 + Test edge case numbers 413 + 414 + $ echo 'positive_zero: +0.0' | yamlcat --json 415 + {"positive_zero": 0} 416 + 417 + $ echo 'negative_zero: -0.0' | yamlcat --json 418 + {"negative_zero": -0} 419 + 420 + $ echo 'very_large: 1.0e100' | yamlcat --json 421 + {"very_large": 1e+100} 422 + 423 + $ echo 'very_small: 1.0e-100' | yamlcat --json 424 + {"very_small": 1e-100} 425 + 426 + Test YAML 1.2 boolean strictness (only true/false are booleans) 427 + 428 + $ echo 'yes: yes' | yamlcat --json 429 + {"yes": true} 430 + 431 + $ echo 'no: no' | yamlcat --json 432 + {"no": false} 433 + 434 + $ echo 'on: on' | yamlcat --json 435 + {"on": true} 436 + 437 + $ echo 'off: off' | yamlcat --json 438 + {"off": false} 439 + 440 + $ echo 'True: True' | yamlcat --json 441 + {"True": true} 442 + 443 + $ echo 'FALSE: FALSE' | yamlcat --json 444 + {"FALSE": false}