My agentic slop goes here. Not intended for anyone else!

more

+1 -4
yaml/ocaml-yamle/tests/cram/dune
···
(cram
(deps
(package yamle)
-
../yaml/seq.yml
-
../yaml/cohttp.yml
-
../yaml/linuxkit.yml
-
../yaml/yaml-1.2.yml))
+
(glob_files ../yaml/*.yml)))
+125
yaml/ocaml-yamle/tests/yaml/anchors_basic.yml
···
+
# Basic Anchor and Alias Test Cases
+
# Tests fundamental anchor (&) and alias (*) functionality
+
+
# Test 1: Simple scalar anchor and alias
+
---
+
scalar_anchor: &simple_scalar "Hello, World!"
+
scalar_alias: *simple_scalar
+
# Expected: both should have the value "Hello, World!"
+
+
# Test 2: Numeric scalar anchor
+
---
+
original: &num 42
+
copy: *num
+
another_copy: *num
+
# Expected: all three should have the value 42
+
+
# Test 3: Sequence anchor and alias
+
---
+
original_list: &my_list
+
- apple
+
- banana
+
- cherry
+
+
copied_list: *my_list
+
# Expected: both lists should be identical
+
+
# Test 4: Mapping anchor and alias
+
---
+
original_map: &person
+
name: Alice
+
age: 30
+
city: London
+
+
copied_map: *person
+
# Expected: both maps should be identical
+
+
# Test 5: Multiple anchors in same document
+
---
+
defaults: &defaults
+
timeout: 30
+
retries: 3
+
+
colors: &colors
+
- red
+
- green
+
- blue
+
+
config:
+
settings: *defaults
+
palette: *colors
+
# Expected: config.settings should have timeout and retries, config.palette should have the color list
+
+
# Test 6: Nested structure with anchor
+
---
+
template: &template
+
metadata:
+
version: 1.0
+
author: John Doe
+
settings:
+
enabled: true
+
debug: false
+
+
instance1: *template
+
instance2: *template
+
# Expected: both instances should be identical copies of template
+
+
# Test 7: Anchor in sequence
+
---
+
items:
+
- &first_item
+
id: 1
+
name: First
+
- id: 2
+
name: Second
+
- *first_item
+
# Expected: first and third items should be identical
+
+
# Test 8: Multiple uses of same alias
+
---
+
shared_value: &shared 100
+
calculations:
+
base: *shared
+
doubled: 200 # Just a value, not calculated
+
reference: *shared
+
another_ref: *shared
+
# Expected: base, reference, and another_ref should all be 100
+
+
# Test 9: Boolean anchor
+
---
+
feature_flag: &enabled true
+
features:
+
login: *enabled
+
signup: *enabled
+
export: *enabled
+
# Expected: all features should be true
+
+
# Test 10: Null anchor
+
---
+
empty: &null_value ~
+
values:
+
first: *null_value
+
second: *null_value
+
# Expected: all should be null
+
+
# Test 11: String with special characters
+
---
+
message: &msg |
+
This is a multi-line
+
message with some
+
special content!
+
+
output1: *msg
+
output2: *msg
+
# Expected: both outputs should have the same multi-line string
+
+
# Test 12: Anchor in mapping value
+
---
+
database:
+
primary: &db_config
+
host: localhost
+
port: 5432
+
ssl: true
+
replica: *db_config
+
backup: *db_config
+
# Expected: primary, replica, and backup should all have identical configuration
+194
yaml/ocaml-yamle/tests/yaml/anchors_merge.yml
···
+
# Merge Key Test Cases
+
# Tests YAML 1.1 merge key (<<) functionality
+
# Note: Merge keys are a YAML 1.1 feature and may not be supported in YAML 1.2
+
+
# Test 1: Basic merge key
+
---
+
defaults: &defaults
+
timeout: 30
+
retries: 3
+
verbose: false
+
+
production:
+
<<: *defaults
+
environment: production
+
# Expected: production should have timeout, retries, verbose from defaults, plus environment
+
+
# Test 2: Override after merge
+
---
+
base: &base
+
color: red
+
size: medium
+
weight: 100
+
+
custom:
+
<<: *base
+
color: blue
+
shape: circle
+
# Expected: custom should have size and weight from base, but color should be blue, and add shape
+
+
# Test 3: Merging multiple anchors
+
---
+
connection: &connection
+
host: localhost
+
port: 8080
+
+
authentication: &auth
+
username: admin
+
password: secret
+
+
server:
+
<<: [*connection, *auth]
+
ssl: true
+
# Expected: server should have host, port, username, password, and ssl
+
+
# Test 4: Multiple merges with override
+
---
+
defaults: &defaults
+
timeout: 30
+
retries: 3
+
+
advanced: &advanced
+
cache: true
+
pool_size: 10
+
+
config:
+
<<: [*defaults, *advanced]
+
timeout: 60
+
custom: value
+
# Expected: config should have all fields from both anchors, with timeout overridden to 60
+
+
# Test 5: Nested merge
+
---
+
base_style: &base_style
+
font: Arial
+
size: 12
+
+
heading_defaults: &heading
+
<<: *base_style
+
weight: bold
+
+
main_heading:
+
<<: *heading
+
size: 18
+
color: navy
+
# Expected: main_heading should inherit from heading (which inherits from base_style) with overrides
+
+
# Test 6: Merge in sequence context
+
---
+
common: &common
+
enabled: true
+
log_level: info
+
+
services:
+
- name: web
+
<<: *common
+
port: 80
+
- name: api
+
<<: *common
+
port: 3000
+
- name: worker
+
<<: *common
+
threads: 4
+
# Expected: each service should have enabled and log_level, plus their specific fields
+
+
# Test 7: Empty merge (edge case)
+
---
+
empty: &empty {}
+
+
config:
+
<<: *empty
+
key: value
+
# Expected: config should just have key: value
+
+
# Test 8: Merge with nested structures
+
---
+
metadata: &metadata
+
created: 2023-01-01
+
author: Admin
+
tags:
+
- v1
+
- stable
+
+
document:
+
<<: *metadata
+
title: Important Document
+
content: Some content here
+
# Expected: document should have all metadata fields plus title and content
+
+
# Test 9: Chain of merges
+
---
+
level1: &l1
+
a: 1
+
b: 2
+
+
level2: &l2
+
<<: *l1
+
c: 3
+
+
level3:
+
<<: *l2
+
d: 4
+
# Expected: level3 should have a, b, c, and d
+
+
# Test 10: Merge with conflicting keys
+
---
+
first: &first
+
name: First
+
value: 100
+
priority: low
+
+
second: &second
+
name: Second
+
value: 200
+
category: important
+
+
combined:
+
<<: [*first, *second]
+
name: Combined
+
# Expected: later merges and direct assignments take precedence
+
+
# Test 11: Merge preserving types
+
---
+
numbers: &numbers
+
count: 42
+
ratio: 3.14
+
active: true
+
+
derived:
+
<<: *numbers
+
label: Test
+
# Expected: types should be preserved (int, float, bool)
+
+
# Test 12: Complex real-world example
+
---
+
db_defaults: &db_defaults
+
pool_size: 5
+
timeout: 30
+
ssl: false
+
+
cache_defaults: &cache_defaults
+
ttl: 3600
+
max_size: 1000
+
+
development:
+
database:
+
<<: *db_defaults
+
host: localhost
+
name: dev_db
+
cache:
+
<<: *cache_defaults
+
backend: memory
+
+
production:
+
database:
+
<<: *db_defaults
+
host: prod.example.com
+
name: prod_db
+
ssl: true
+
pool_size: 20
+
cache:
+
<<: *cache_defaults
+
backend: redis
+
ttl: 7200
+
# Expected: each environment should inherit defaults with environment-specific overrides
+126
yaml/ocaml-yamle/tests/yaml/collections_block.yml
···
+
# Block Style Collections Test File
+
# Testing various block-style collection structures
+
+
# Simple sequence
+
simple_sequence:
+
- apple
+
- banana
+
- cherry
+
- date
+
+
# Simple mapping
+
simple_mapping:
+
name: John Doe
+
age: 30
+
city: New York
+
country: USA
+
+
# Nested sequences
+
nested_sequences:
+
- - alpha
+
- beta
+
- gamma
+
- - one
+
- two
+
- three
+
- - red
+
- green
+
- blue
+
+
# Nested mappings
+
nested_mappings:
+
person:
+
name: Alice
+
contact:
+
email: alice@example.com
+
phone: 555-1234
+
address:
+
street: 123 Main St
+
city: Boston
+
+
# Mapping containing sequences
+
mapping_with_sequences:
+
colors:
+
- red
+
- green
+
- blue
+
sizes:
+
- small
+
- medium
+
- large
+
numbers:
+
- 1
+
- 2
+
- 3
+
+
# Sequence containing mappings
+
sequence_with_mappings:
+
- name: Alice
+
age: 25
+
role: developer
+
- name: Bob
+
age: 30
+
role: designer
+
- name: Charlie
+
age: 35
+
role: manager
+
+
# Deep nesting (4 levels)
+
deep_nesting:
+
level1:
+
level2:
+
level3:
+
level4:
+
- deeply
+
- nested
+
- values
+
another_key: value
+
items:
+
- item1
+
- item2
+
metadata:
+
created: 2024-01-01
+
modified: 2024-12-04
+
+
# Mixed complex structure
+
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 sequences and mappings in block style
+
empty_collections:
+
empty_sequence: []
+
empty_mapping: {}
+
sequence_with_empty:
+
- value1
+
- []
+
- value2
+
mapping_with_empty:
+
key1: value1
+
key2: {}
+
key3: value3
+198
yaml/ocaml-yamle/tests/yaml/collections_compact.yml
···
+
# Compact Notation Collections Test File
+
# Testing compact block notation and mixed styles
+
+
# Compact nested mapping in sequence (most common form)
+
compact_sequence:
+
- name: Alice
+
age: 25
+
city: Boston
+
- name: Bob
+
age: 30
+
city: Seattle
+
- name: Charlie
+
age: 35
+
city: Portland
+
+
# Compact with nested structures
+
compact_nested:
+
- id: 1
+
details:
+
type: admin
+
permissions:
+
- read
+
- write
+
- delete
+
- id: 2
+
details:
+
type: user
+
permissions:
+
- read
+
+
# Multiple keys in same sequence entry with sub-structures
+
compact_complex:
+
- key1: value1
+
key2: value2
+
nested:
+
sub1: val1
+
sub2: val2
+
- key1: value3
+
key2: value4
+
nested:
+
sub1: val3
+
sub2: val4
+
+
# Compact block mappings with inline values
+
users:
+
- username: alice
+
email: alice@example.com
+
active: true
+
- username: bob
+
email: bob@example.com
+
active: false
+
+
# Compact with flow collections
+
compact_with_flow:
+
- name: service1
+
ports: [8080, 8443]
+
env: {DEBUG: true, MODE: production}
+
- name: service2
+
ports: [3000]
+
env: {DEBUG: false, MODE: development}
+
+
# Deeply nested compact notation
+
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
+
+
# Compact with mixed indentation styles
+
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 entries
+
single_line_compact:
+
- {name: Alice, age: 25, role: developer}
+
- {name: Bob, age: 30, role: designer}
+
- {name: Charlie, age: 35, role: manager}
+
+
# Compact notation with sequences as values
+
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 values
+
compact_with_empty:
+
- id: 1
+
data: []
+
meta: {}
+
- id: 2
+
data:
+
- item1
+
meta:
+
key: value
+
+
# Compact notation with complex nesting
+
compact_complex_nesting:
+
- level: 1
+
children:
+
- level: 2a
+
children:
+
- level: 3a
+
value: leaf1
+
- level: 3b
+
value: leaf2
+
- level: 2b
+
children:
+
- level: 3c
+
value: leaf3
+
+
# Real-world example: API endpoints
+
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 with various data types
+
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: ~
+
+
# Edge case: minimal compact notation
+
minimal:
+
- a: 1
+
- b: 2
+
- c: 3
+96
yaml/ocaml-yamle/tests/yaml/collections_flow.yml
···
+
# Flow Style Collections Test File
+
# Testing various flow-style collection structures
+
+
# Simple flow sequence
+
simple_flow_sequence: [apple, banana, cherry, date]
+
+
# Simple flow mapping
+
simple_flow_mapping: {name: John, age: 30, city: New York}
+
+
# Nested flow sequences
+
nested_flow_sequences: [[a, b, c], [1, 2, 3], [red, green, blue]]
+
+
# Nested flow mappings
+
nested_flow_mappings: {person: {name: Alice, age: 25}, contact: {email: alice@example.com, phone: 555-1234}}
+
+
# Flow sequence with mappings
+
flow_seq_with_maps: [{name: Alice, role: dev}, {name: Bob, role: ops}, {name: Charlie, role: qa}]
+
+
# Flow mapping with sequences
+
flow_map_with_seqs: {colors: [red, green, blue], sizes: [S, M, L], numbers: [1, 2, 3]}
+
+
# Deeply nested flow collections
+
deep_flow_nesting: {level1: {level2: {level3: {level4: [a, b, c]}}}}
+
+
# Empty flow collections
+
empty_flow: {empty_seq: [], empty_map: {}, both: [[], {}]}
+
+
# Mixed flow and block - flow in block
+
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}
+
+
# Mixed flow and block - block in flow
+
block_in_flow: {
+
users: [
+
{name: Alice, tags: [dev, senior]},
+
{name: Bob, tags: [ops, junior]}
+
]
+
}
+
+
# Complex mixed structure
+
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.0, enabled: true}
+
+
# Flow sequences with various types
+
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 mappings with various types
+
flow_map_types: {
+
string: value,
+
number: 42,
+
boolean: true,
+
null_value: null,
+
float: 3.14
+
}
+
+
# Nested mixed collections
+
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}}
+
+
# Flow with multiline (should still be valid)
+
multiline_flow:
+
long_sequence: [
+
item1,
+
item2,
+
item3,
+
item4
+
]
+
long_mapping: {
+
key1: value1,
+
key2: value2,
+
key3: value3
+
}
+
+
# Edge cases
+
edge_cases:
+
single_item_seq: [alone]
+
single_item_map: {only: one}
+
nested_empty: [[], [{}], [{}, []]]
+
all_empty: [{}, [], {a: []}, {b: {}}]
+53
yaml/ocaml-yamle/tests/yaml/comments.yml
···
+
# Full line comment at the beginning
+
# This is a YAML file testing comment handling
+
+
# Comment before a mapping
+
name: John Doe # End of line comment after a scalar value
+
age: 30 # Another end of line comment
+
+
# Comment between mapping entries
+
address:
+
# Comment inside nested mapping
+
street: 123 Main St # End of line comment in nested value
+
city: Springfield
+
# Comment between nested entries
+
zip: 12345
+
+
# Comment before sequence
+
items:
+
- apple # Comment after sequence item
+
- banana
+
# Comment between sequence items
+
- cherry
+
- date # Last item comment
+
+
# Comment before flow sequence
+
flow_seq: [1, 2, 3] # Comment after flow sequence
+
+
# Comment before flow mapping
+
flow_map: {key1: value1, key2: value2} # Comment after flow mapping
+
+
# Comments with various indentation levels
+
nested:
+
# Indented comment level 1
+
level1:
+
# Indented comment level 2
+
level2:
+
# Indented comment level 3
+
value: deeply nested # End comment at depth
+
+
# Multiple consecutive comments
+
# Line 1
+
# Line 2
+
# Line 3
+
multi_comment_key: value
+
+
# Comment with special characters: !@#$%^&*()
+
special: "value with # hash inside quotes"
+
+
# Empty value with comment
+
empty_value: # This key has no value (null)
+
+
# Comment before document end
+
final_key: final_value
+
# Final comment at end of file
+8
yaml/ocaml-yamle/tests/yaml/directives.yml
···
+
# YAML directive tests
+
+
# Test 1: %YAML 1.2 directive
+
%YAML 1.2
+
---
+
version: "1.2"
+
content: This document uses YAML 1.2
+
...
+15
yaml/ocaml-yamle/tests/yaml/directives_multiple_tags.yml
···
+
# Test 4: Multiple TAG directives
+
%YAML 1.2
+
%TAG !e! tag:example.com,2025:
+
%TAG !app! tag:myapp.org,2025:types:
+
%TAG !geo! tag:geography.net,2025:shapes:
+
---
+
user: !e!person
+
name: Alice
+
age: 30
+
location: !geo!coordinates
+
lat: 40.7128
+
lon: -74.0060
+
config: !app!settings
+
debug: true
+
timeout: 30
+10
yaml/ocaml-yamle/tests/yaml/directives_tag.yml
···
+
# Test 3: %TAG directive with custom prefix
+
%YAML 1.2
+
%TAG !custom! tag:example.com,2025:
+
---
+
shape: !custom!circle
+
radius: 5
+
color: red
+
point: !custom!point
+
x: 10
+
y: 20
+10
yaml/ocaml-yamle/tests/yaml/directives_yaml11.yml
···
+
# Test 2: %YAML 1.1 directive
+
%YAML 1.1
+
---
+
version: "1.1"
+
content: This document uses YAML 1.1
+
booleans:
+
- yes
+
- no
+
- on
+
- off
+15
yaml/ocaml-yamle/tests/yaml/documents_multi.yml
···
+
# Multiple document variations
+
+
# Test 1: Two documents separated by ---
+
---
+
document: first
+
type: mapping
+
data:
+
key1: value1
+
key2: value2
+
---
+
document: second
+
type: mapping
+
data:
+
key3: value3
+
key4: value4
+10
yaml/ocaml-yamle/tests/yaml/documents_multi_empty.yml
···
+
# Test 4: Empty documents
+
---
+
# Empty document (implicitly null)
+
---
+
key: value
+
---
+
# Another empty document
+
---
+
- item1
+
- item2
+15
yaml/ocaml-yamle/tests/yaml/documents_multi_three.yml
···
+
# Test 2: Three documents with different content types
+
---
+
# First document: mapping
+
name: John Doe
+
age: 30
+
city: New York
+
---
+
# Second document: sequence
+
- apple
+
- banana
+
- orange
+
- grape
+
---
+
# Third document: scalar
+
This is a plain scalar document
+16
yaml/ocaml-yamle/tests/yaml/documents_multi_with_end.yml
···
+
# Test 3: Documents with explicit end markers
+
---
+
first:
+
document: data1
+
value: 100
+
...
+
---
+
second:
+
document: data2
+
value: 200
+
...
+
---
+
third:
+
document: data3
+
value: 300
+
...
+11
yaml/ocaml-yamle/tests/yaml/documents_single.yml
···
+
# Single document variations
+
+
# Test 1: Implicit document (no markers)
+
key1: value1
+
key2: value2
+
nested:
+
inner: data
+
list:
+
- item1
+
- item2
+
- item3
+11
yaml/ocaml-yamle/tests/yaml/documents_single_explicit_both.yml
···
+
# Test 3: Explicit start and end (--- ... )
+
---
+
key1: value1
+
key2: value2
+
nested:
+
inner: data
+
list:
+
- item1
+
- item2
+
- item3
+
...
+10
yaml/ocaml-yamle/tests/yaml/documents_single_explicit_start.yml
···
+
# Test 2: Explicit start (---)
+
---
+
key1: value1
+
key2: value2
+
nested:
+
inner: data
+
list:
+
- item1
+
- item2
+
- item3
+11
yaml/ocaml-yamle/tests/yaml/documents_single_with_directive.yml
···
+
# Test 4: With %YAML directive
+
%YAML 1.2
+
---
+
key1: value1
+
key2: value2
+
nested:
+
inner: data
+
list:
+
- item1
+
- item2
+
- item3
+155
yaml/ocaml-yamle/tests/yaml/edge_cases.yml
···
+
# Edge cases test file for YAML parsing
+
+
# Case 1: Keys with colons (must be quoted)
+
"key:with:colons": value
+
"http://example.com": url_as_key
+
"time:12:30": time_value
+
+
# Case 2: Values starting with indicators (must be quoted or escaped)
+
indicator_square: "[this starts with bracket]"
+
indicator_curly: "{this starts with brace}"
+
indicator_star: "*this starts with star"
+
indicator_amp: "&this starts with ampersand"
+
indicator_question: "?this starts with question"
+
indicator_pipe: "|this starts with pipe"
+
indicator_gt: ">this starts with gt"
+
indicator_dash: "-this starts with dash"
+
indicator_hash: "#this starts with hash"
+
+
# Case 3: Special string values that look like other types
+
string_true: "true"
+
string_false: "false"
+
string_null: "null"
+
string_number: "123"
+
string_float: "45.67"
+
string_yes: "yes"
+
string_no: "no"
+
+
# Case 4: Actual special values
+
bool_true: true
+
bool_false: false
+
null_value: null
+
null_tilde: ~
+
number_int: 123
+
number_float: 45.67
+
number_exp: 1.23e4
+
number_hex: 0x1F
+
number_oct: 0o17
+
+
# Case 5: Empty values
+
empty_string: ""
+
empty_list: []
+
empty_map: {}
+
null_implicit:
+
+
# Case 6: Very long lines
+
very_long_key: "This is a very long value that contains a lot of text to test how the parser handles long lines. It should be able to handle lines that are much longer than typical lines in most YAML files. This continues for quite a while to make sure we test the boundaries of reasonable line lengths. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
+
+
very_long_literal: |
+
This is a very long literal block that should preserve all the whitespace and newlines exactly as written. It can contain very long lines that go on and on and on without breaking. This tests whether the parser can handle long content in literal blocks properly. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+
# Case 7: Unicode and special characters
+
unicode_emoji: "Hello 🌍 World 🚀"
+
unicode_chars: "Héllo Wörld 你好 مرحبا"
+
unicode_key_🔑: unicode_value
+
escaped_chars: "Line1\nLine2\tTabbed"
+
+
# Case 8: Nested empty structures
+
nested_empty:
+
level1: {}
+
level2:
+
inner: []
+
level3:
+
inner:
+
deep: null
+
+
# Case 9: Complex keys (flow collections as keys)
+
? [complex, key]
+
: complex_value
+
? {nested: key}
+
: another_value
+
+
# Case 10: Multi-line keys and values
+
? |
+
This is a multi-line
+
key using literal block
+
: |
+
This is a multi-line
+
value using literal block
+
+
# Case 11: Quoted strings with escape sequences
+
single_quoted: 'It''s a single-quoted string with doubled quotes'
+
double_quoted: "It's a \"double-quoted\" string with escapes"
+
backslash: "Path\\to\\file"
+
newline_escape: "First line\nSecond line"
+
+
# Case 12: Anchors and aliases at edge positions
+
anchor_list: &anchor_ref
+
- item1
+
- item2
+
- item3
+
+
alias_usage: *anchor_ref
+
+
nested_anchor:
+
data: &nested_ref
+
key: value
+
reference: *nested_ref
+
+
# Case 13: Mixed flow and block styles
+
mixed_style:
+
block_key:
+
- flow_in_block: [1, 2, 3]
+
- another: {a: 1, b: 2}
+
flow_key: {block_in_flow:
+
- item1
+
- item2}
+
+
# Case 14: Trailing commas in flow (typically invalid in YAML)
+
# flow_trailing: [1, 2, 3,] # This would be invalid
+
+
# Case 15: Strings that need quoting
+
needs_quote_1: "value with # in it"
+
needs_quote_2: "value with: colon"
+
needs_quote_3: "value with @ at sign"
+
needs_quote_4: "value with ` backtick"
+
+
# Case 16: Multiple documents separator (not starting a new document)
+
not_doc_separator: "--- this is just a string value"
+
+
# Case 17: Extremely nested structures
+
deeply_nested:
+
l1:
+
l2:
+
l3:
+
l4:
+
l5:
+
l6:
+
l7:
+
l8:
+
l9:
+
l10: "deep value"
+
+
# Case 18: Large sequence
+
large_sequence:
+
- item_001
+
- item_002
+
- item_003
+
- item_004
+
- item_005
+
- item_006
+
- item_007
+
- item_008
+
- item_009
+
- item_010
+
+
# Case 19: Keys and values with only whitespace differences
+
" key": "value with leading space in key"
+
"key ": "value with trailing space in key"
+
" spaced ": " spaced "
+
+
# Case 20: Binary-looking values
+
binary_string: "0b101010"
+
hex_string: "0xDEADBEEF"
+
+
# End of edge cases test file
+192
yaml/ocaml-yamle/tests/yaml/scalars_block.yml
···
+
# Block scalars - literal and folded styles
+
---
+
# Literal style (|) - preserves newlines
+
literal_basic: |
+
Line one
+
Line two
+
Line three
+
+
literal_with_indent: |
+
First line
+
Indented line
+
More indented
+
Back to second level
+
Back to first level
+
+
# Folded style (>) - converts newlines to spaces
+
folded_basic: >
+
This is a long paragraph
+
that will be folded into
+
a single line with the
+
newlines converted to spaces.
+
+
folded_paragraph: >
+
First paragraph flows together
+
into a single line.
+
+
Second paragraph after blank line
+
also flows together.
+
+
# Chomping indicators
+
# Strip (-) - removes trailing newlines
+
literal_strip: |-
+
No trailing newline
+
+
+
literal_strip_multiple: |-
+
Text here
+
+
+
folded_strip: >-
+
Folded text
+
with stripped
+
trailing newlines
+
+
+
# Clip (default) - keeps single trailing newline
+
literal_clip: |
+
One trailing newline
+
+
+
literal_clip_explicit: |
+
This is the default behavior
+
+
+
folded_clip: >
+
Folded with one
+
trailing newline
+
+
+
# Keep (+) - preserves all trailing newlines
+
literal_keep: |+
+
Keeps trailing newlines
+
+
+
literal_keep_multiple: |+
+
Text here
+
+
+
folded_keep: >+
+
Folded text
+
keeps trailing
+
+
+
# Explicit indentation indicators
+
literal_indent_2: |2
+
Two space indentation
+
is preserved here
+
Extra indent
+
Back to two
+
+
literal_indent_4: |4
+
Four space base indent
+
Second line
+
Extra indent
+
Back to base
+
+
folded_indent_2: >2
+
Text with two space
+
base indentation that
+
will be folded.
+
+
folded_indent_3: >3
+
Three space indent
+
for this folded
+
text block.
+
+
# Combinations of indicators
+
literal_indent_strip: |2-
+
Indented by 2
+
No trailing newlines
+
+
+
folded_indent_strip: >3-
+
Folded with indent
+
and stripped end
+
+
+
literal_indent_keep: |2+
+
Indented by 2
+
Keeps trailing newlines
+
+
+
folded_indent_keep: >4+
+
Folded indent 4
+
keeps all trailing
+
+
+
# Empty block scalars
+
empty_literal: |
+
+
empty_folded: >
+
+
# Block scalar with only newlines
+
only_newlines_literal: |
+
+
+
only_newlines_folded: >
+
+
+
# Complex indentation patterns
+
complex_literal: |
+
First level
+
Second level
+
Third level
+
Back to second
+
Back to first
+
+
New paragraph
+
With indent
+
+
Final paragraph
+
+
complex_folded: >
+
This paragraph
+
flows together.
+
+
This is separate.
+
This line starts more indented
+
and continues.
+
+
Final thoughts here.
+
+
# Special characters in block scalars
+
special_chars_literal: |
+
Special: @#$%^&*()
+
Quotes: "double" 'single'
+
Brackets: [array] {object}
+
Symbols: | > & * ? : -
+
+
special_chars_folded: >
+
All special chars are literal
+
in block scalars: []{}|>*&
+
+
# Block scalars in sequences
+
sequence_with_blocks:
+
- |
+
First item
+
literal block
+
- >
+
Second item
+
folded block
+
- |-
+
Third item
+
stripped
+
- |+
+
Fourth item
+
kept
+
+
+
# Block scalars in nested mappings
+
nested:
+
description: >
+
This is a folded
+
description that spans
+
multiple lines.
+
code: |
+
def hello():
+
print("Hello, World!")
+
return True
+
notes: |-
+
Final notes
+
with stripped end
+60
yaml/ocaml-yamle/tests/yaml/scalars_plain.yml
···
+
# Plain scalars - no quotes needed
+
---
+
# Simple words
+
simple_word: hello
+
single_character: x
+
number_like: 123
+
boolean_like: true
+
null_like: null
+
+
# Multi-word values (no special meaning characters)
+
sentence: this is a plain scalar
+
phrase: plain scalars can have spaces
+
+
# Numbers and special values that remain strings in context
+
age: 42
+
pi: 3.14159
+
negative: -273
+
scientific: 1.23e-4
+
hex_like: 0x1A2B
+
octal_like: 0o755
+
+
# Special characters that are valid in plain scalars
+
with_colon: "value: with colon needs quotes in value"
+
with_comma: "commas, need quotes in flow context"
+
with_hash: "# needs quotes if starting with hash"
+
hyphen_start: "- needs quotes if starting like list"
+
question_start: "? needs quotes if starting like mapping key"
+
+
# Plain scalars with valid special characters
+
email: user@example.com
+
url: http://example.com/path
+
path: /usr/local/bin
+
ratio: 16:9
+
version: v1.2.3
+
+
# Multi-line plain scalars (line folding)
+
# Newlines become spaces, blank lines become newlines
+
folded_plain: This is a long
+
plain scalar that spans
+
multiple lines and will
+
be folded into a single line
+
with spaces.
+
+
another_folded: First paragraph
+
continues here and here.
+
+
Second paragraph after blank line.
+
Also continues.
+
+
# Trailing and leading spaces are trimmed in plain scalars
+
spaces_trimmed: value with spaces
+
+
# Plain scalars can contain most punctuation
+
punctuation: Hello, world! How are you? I'm fine.
+
symbols: $100 & 50% off @ store #1
+
math: 2+2=4 and 3*3=9
+
+
# Empty plain scalar (becomes null)
+
empty_implicit:
+
explicit_empty: ""
+81
yaml/ocaml-yamle/tests/yaml/scalars_quoted.yml
···
+
# Quoted scalars - single and double quoted strings
+
---
+
# Single-quoted strings
+
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-quoted strings
+
double_simple: "hello world"
+
double_with_single: "It's easy"
+
double_escaped_quote: "She said \"hello\""
+
+
# Escape sequences in double-quoted strings
+
escaped_newline: "Line one\nLine two\nLine three"
+
escaped_tab: "Column1\tColumn2\tColumn3"
+
escaped_backslash: "Path: C:\\Users\\Name"
+
escaped_carriage: "Before\rAfter"
+
escaped_bell: "Bell\a"
+
escaped_backspace: "Back\b"
+
escaped_formfeed: "Form\f"
+
escaped_vertical: "Vertical\vtab"
+
+
# Unicode escapes
+
unicode_16bit: "Snowman: \u2603"
+
unicode_32bit: "Emoji: \U0001F600"
+
unicode_hex: "Null byte: \x00"
+
+
# Empty strings
+
empty_single: ''
+
empty_double: ""
+
+
# Strings that would be interpreted as other types if unquoted
+
string_true: "true"
+
string_false: "false"
+
string_null: "null"
+
string_number: "123"
+
string_float: "45.67"
+
string_octal: "0o755"
+
string_hex: "0xFF"
+
+
# Special YAML characters that need quoting
+
starts_with_at: "@username"
+
starts_with_backtick: "`command`"
+
starts_with_ampersand: "&reference"
+
starts_with_asterisk: "*alias"
+
starts_with_exclamation: "!tag"
+
starts_with_pipe: "|literal"
+
starts_with_gt: ">folded"
+
starts_with_percent: "%directive"
+
+
# Flow indicators that need quoting
+
with_brackets: "[not a list]"
+
with_braces: "{not: a map}"
+
with_comma: "a, b, c"
+
with_colon_space: "key: value"
+
+
# Quoted strings preserve leading/trailing whitespace
+
leading_space: " spaces before"
+
trailing_space: "spaces after "
+
both_spaces: " spaces both "
+
+
# Multi-line quoted strings
+
double_multiline: "This is a string
+
that spans multiple
+
lines with escaped newlines."
+
+
single_fold: 'This single quoted
+
string will fold
+
lines into spaces.'
+
+
# Complex escape sequences
+
complex_escapes: "Tab:\t Newline:\n Quote:\" Backslash:\\ Unicode:\u0041"
+
+
# Edge cases
+
only_spaces_single: ' '
+
only_spaces_double: " "
+
only_newlines: "\n\n\n"
+
mixed_quotes: "She said 'it''s a beautiful day'"
+82
yaml/ocaml-yamle/tests/yaml/values_bool.yml
···
+
# Boolean value test cases for YAML 1.2
+
# Note: YAML 1.2 only recognizes 'true' and 'false' as booleans
+
# Other values like yes/no, on/off are treated as strings in 1.2
+
+
# Standard YAML 1.2 booleans (lowercase)
+
bool_true: true
+
bool_false: false
+
+
# Capitalized forms (should be strings in YAML 1.2)
+
capitalized_true: True
+
capitalized_false: False
+
+
# YAML 1.1 style booleans (should be strings in YAML 1.2)
+
yes_value: yes
+
no_value: no
+
Yes_value: Yes
+
No_value: No
+
YES_value: YES
+
NO_value: NO
+
+
# On/Off style (should be strings in YAML 1.2)
+
on_value: on
+
off_value: off
+
On_value: On
+
Off_value: Off
+
ON_value: ON
+
OFF_value: OFF
+
+
# Booleans in sequences
+
bool_sequence:
+
- true
+
- false
+
- yes
+
- no
+
- on
+
- off
+
+
# Booleans in flow style
+
flow_bools: [true, false, yes, no]
+
+
# Booleans in mappings
+
bool_mapping:
+
active: true
+
disabled: false
+
enabled: yes
+
stopped: no
+
+
# String literals that should NOT be parsed as booleans
+
quoted_bools:
+
quoted_true: "true"
+
quoted_false: "false"
+
quoted_yes: "yes"
+
quoted_no: "no"
+
single_true: 'true'
+
single_false: 'false'
+
+
# Nested boolean values
+
nested_bools:
+
settings:
+
debug: true
+
verbose: false
+
legacy_yes: yes
+
legacy_no: no
+
flags:
+
- true
+
- false
+
- on
+
- off
+
+
# Mixed case variations
+
mixed_case:
+
TRUE: TRUE
+
FALSE: FALSE
+
TrUe: TrUe
+
FaLsE: FaLsE
+
+
# Boolean-like strings that should remain strings
+
bool_like_strings:
+
truthy: truely
+
falsy: falsetto
+
yes_sir: yessir
+
no_way: noway
+55
yaml/ocaml-yamle/tests/yaml/values_null.yml
···
+
# Null value test cases for YAML 1.2
+
+
# Explicit null keyword
+
explicit_null: null
+
+
# Tilde shorthand for null
+
tilde_null: ~
+
+
# Empty value (implicit null)
+
empty_null:
+
+
# Null in flow style
+
flow_null: [null, ~, ]
+
+
# Null in sequences
+
sequence_nulls:
+
- null
+
- ~
+
-
+
- explicit: null
+
- tilde: ~
+
- empty:
+
+
# Null in mappings
+
mapping_nulls:
+
key1: null
+
key2: ~
+
key3:
+
+
# Null as key
+
null: "null key with string value"
+
~: "tilde key with string value"
+
+
# Mixed null values in nested structures
+
nested:
+
level1:
+
null_value: null
+
tilde_value: ~
+
empty_value:
+
list:
+
- null
+
- ~
+
-
+
- some_value
+
map:
+
a: null
+
b: ~
+
c:
+
+
# String literals that contain "null" (should NOT be parsed as null)
+
string_nulls:
+
quoted_null: "null"
+
quoted_tilde: "~"
+
null_in_string: "this is null"
+
word_null: 'null'
+120
yaml/ocaml-yamle/tests/yaml/values_numbers.yml
···
+
# Numeric value test cases for YAML 1.2
+
+
# Integers
+
int_zero: 0
+
int_positive: 42
+
int_negative: -17
+
int_large: 1000000
+
int_with_underscores: 1_000_000
+
+
# Octal notation (YAML 1.2 style with 0o prefix)
+
octal_value: 0o14
+
octal_zero: 0o0
+
octal_large: 0o777
+
+
# Hexadecimal notation
+
hex_lowercase: 0x1a
+
hex_uppercase: 0x1A
+
hex_mixed: 0xDeadBeef
+
hex_zero: 0x0
+
+
# Floating point numbers
+
float_simple: 3.14
+
float_negative: -0.5
+
float_zero: 0.0
+
float_leading_dot: .5
+
float_trailing_zero: 1.0
+
+
# Scientific notation
+
scientific_positive: 1.0e10
+
scientific_negative: 1.5e-3
+
scientific_uppercase: 2.5E+2
+
scientific_no_sign: 3.0e5
+
+
# Special floating point values
+
positive_infinity: .inf
+
negative_infinity: -.inf
+
not_a_number: .nan
+
infinity_upper: .Inf
+
infinity_caps: .INF
+
nan_upper: .NaN
+
nan_caps: .NAN
+
+
# Numbers in sequences
+
number_sequence:
+
- 0
+
- 42
+
- -17
+
- 3.14
+
- 1.0e10
+
- .inf
+
- .nan
+
+
# Numbers in flow style
+
flow_numbers: [0, 42, -17, 3.14, 0x1A, 0o14]
+
+
# Numbers in mappings
+
number_mapping:
+
count: 100
+
price: 19.99
+
discount: -5.0
+
hex_color: 0xFF5733
+
octal_perms: 0o755
+
scientific: 6.022e23
+
+
# String literals that look like numbers (quoted)
+
quoted_numbers:
+
string_int: "42"
+
string_float: "3.14"
+
string_hex: "0x1A"
+
string_octal: "0o14"
+
string_inf: ".inf"
+
string_nan: ".nan"
+
+
# Numeric strings that should remain strings
+
numeric_strings:
+
phone: 555-1234
+
version: 1.2.3
+
code: 00123
+
leading_zero: 007
+
plus_sign: +123
+
+
# Edge cases
+
edge_cases:
+
min_int: -9223372036854775808
+
max_int: 9223372036854775807
+
very_small: 1.0e-100
+
very_large: 1.0e100
+
negative_zero: -0.0
+
positive_zero: +0.0
+
+
# Nested numeric values
+
nested_numbers:
+
coordinates:
+
x: 10.5
+
y: -20.3
+
z: 0.0
+
measurements:
+
- 1.1
+
- 2.2
+
- 3.3
+
stats:
+
count: 1000
+
average: 45.67
+
max: .inf
+
min: -.inf
+
+
# YAML 1.1 style octals (no 0o prefix) - should be strings in YAML 1.2
+
legacy_octal: 014
+
+
# Binary notation (not part of YAML 1.2 core, but sometimes supported)
+
# These should be treated as strings in strict YAML 1.2
+
binary_like: 0b1010
+
+
# Numbers with various formats
+
format_tests:
+
no_decimal: 42
+
with_decimal: 42.0
+
leading_zero_decimal: 0.42
+
no_leading_digit: .42
+
trailing_decimal: 42.
+101
yaml/ocaml-yamle/tests/yaml/values_timestamps.yml
···
+
# Timestamp value test cases for YAML 1.1
+
# Note: YAML 1.2 does not have a timestamp type in the core schema
+
# These are recognized in YAML 1.1 and some extended schemas
+
+
# ISO 8601 date format (YYYY-MM-DD)
+
date_simple: 2001-12-15
+
date_earliest: 1970-01-01
+
date_leap_year: 2020-02-29
+
date_current: 2025-12-04
+
+
# ISO 8601 datetime with timezone (UTC)
+
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
+
+
# ISO 8601 datetime with timezone offset
+
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
+
+
# Spaced datetime format (YAML 1.1 style)
+
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 without fractional seconds
+
datetime_no_frac: 2001-12-15T14:30:00Z
+
+
# Date only (no time component)
+
date_only: 2001-12-15
+
+
# Various formats
+
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
+
+
# Timestamps in sequences
+
timestamp_sequence:
+
- 2001-12-15
+
- 2001-12-15T02:59:43.1Z
+
- 2001-12-14 21:59:43.10 -5
+
- 2025-01-01T00:00:00Z
+
+
# Timestamps in mappings
+
events:
+
created: 2001-12-15T02:59:43.1Z
+
modified: 2001-12-16T10:30:00Z
+
published: 2001-12-14 21:59:43.10 -5
+
+
# String literals that look like timestamps (quoted)
+
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 and variations
+
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 timestamp values
+
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 timestamp formats (should be treated as strings)
+
invalid_timestamps:
+
bad_date: 2001-13-45
+
bad_time: 2001-12-15T25:99:99Z
+
incomplete: 2001-12
+
no_leading_zero: 2001-1-5
+
+
# Different timezone representations
+
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
+
+
# Historical and future dates
+
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
+105
yaml/ocaml-yamle/tests/yaml/whitespace.yml
···
+
# Whitespace handling test file
+
+
# Section 1: Different indentation levels (2 spaces)
+
two_space_indent:
+
level1:
+
level2:
+
level3: value
+
+
# Section 2: Four space indentation
+
four_space_indent:
+
level1:
+
level2:
+
level3: value
+
+
# Section 3: Mixed content with blank lines
+
+
first_key: first_value
+
+
+
second_key: second_value
+
+
+
+
third_key: third_value
+
+
# Section 4: Sequences with varying indentation
+
sequence_2space:
+
- item1
+
- item2
+
- nested:
+
- nested_item1
+
- nested_item2
+
+
sequence_4space:
+
- item1
+
- item2
+
- nested:
+
- nested_item1
+
- nested_item2
+
+
# Section 5: Trailing whitespace (spaces after values - invisible but present)
+
trailing_spaces: value
+
another_key: another_value
+
+
# Section 6: Leading whitespace preservation in literals
+
literal_block: |
+
This is a literal block
+
with preserved indentation
+
including extra spaces
+
and blank lines
+
+
like this one above
+
+
folded_block: >
+
This is a folded block
+
that will be folded into
+
a single line but preserves
+
+
paragraph breaks like above
+
+
# Section 7: Whitespace in flow collections
+
flow_with_spaces: [ item1 , item2 , item3 ]
+
flow_tight: [item1,item2,item3]
+
flow_map_spaces: { key1: value1 , key2: value2 }
+
flow_map_tight: {key1:value1,key2:value2}
+
+
# Section 8: Multiple consecutive blank lines between top-level keys
+
key_before_blanks: value1
+
+
+
+
+
key_after_blanks: value2
+
+
# Section 9: Indentation in mappings
+
mapping_indent:
+
key1: value1
+
key2: value2
+
nested:
+
nested_key1: nested_value1
+
nested_key2: nested_value2
+
deep_nested:
+
deep_key: deep_value
+
+
# Section 10: Whitespace around colons and hyphens
+
no_space_colon:value
+
space_after_colon: value
+
spaces_around: value
+
- sequence_item_no_space
+
- nested_sequence
+
+
# Section 11: Empty lines in sequences
+
sequence_with_blanks:
+
- item1
+
+
- item2
+
+
- item3
+
+
# Section 12: Whitespace-only mapping values (implicit null)
+
explicit_null: null
+
implicit_null:
+
space_only:
+
+
# End of whitespace test file