Skip to content

Improve toml-test compliance to 99.5%#1

Merged
dereuromark merged 6 commits intomasterfrom
fix/toml-test-compliance
Mar 25, 2026
Merged

Improve toml-test compliance to 99.5%#1
dereuromark merged 6 commits intomasterfrom
fix/toml-test-compliance

Conversation

@dereuromark
Copy link
Contributor

Summary

  • Improve toml-test compliance from 88% to 99.5% valid / 90.3% invalid
  • Fix date/time tokens being rejected as bare keys (e.g., 2001-02-03 = 1)
  • Fix leading-zero floats being incorrectly split into dotted keys (e.g., 01.23)
  • Fix datetime parser stopping at . unless it's fractional seconds
  • Fix implicit vs explicit table definition handling
  • Fix inline table scope isolation for dotted keys
  • Fix array parsing to reject double commas
  • Add control character validation to comments and multi-line strings
  • Fix array table traversal in the decoder
  • Rename tests/Fixtures to tests/fixtures (lowercase for non-class folders)
  • Update documentation with compliance numbers

Test Results

Test Type TOML 1.1 TOML 1.0
Valid 213/214 (99.5%) 204/205 (99.5%)
Invalid 421/466 (90.3%) 421/473 (89.0%)

The single valid test failure is due to a PHP limitation with null byte property names. Invalid test "failures" are mostly TOML 1.0 strict tests that TOML 1.1 relaxes (multiline inline tables, trailing commas, hex escapes).

Parser improvements:
- Add date/time tokens as valid keys (e.g., 2001-02-03 = 1)
- Split leading-zero floats into dotted key parts (01.23 = x → {"01": {"23": x}})
- Allow explicit definition of implicit tables ([x.y] followed by [x])
- Add control character validation in comments and multi-line strings
- Fix array parsing to reject double commas ([1,,2])
- Fix inline table scope isolation for dotted key validation

Decoder improvements:
- Handle array tables in nested path traversal
- Normalize no-seconds times to include :00
- Preserve original datetime precision (no unnecessary microseconds)

Also renames tests/Fixtures to tests/fixtures for consistency.
Cover tab characters used as whitespace/indentation in:
- Before keys
- Around equals signs
- Multiline array indentation
- Multiline inline table indentation
- Mixed tabs and spaces
- After table headers
- In comments
- Between array/inline table elements
- Inside table header brackets
Verify tab characters are preserved in source-aware encoding:
- Tab around keys and equals signs
- Tab indentation in multiline arrays
- Tab indentation in multiline inline tables
- Mixed tab and space whitespace
- Restore Feature Comparison and Library Details sections
- Keep benchmark data and updated compliance numbers
- Add round-trip tests for tab whitespace preservation
@dereuromark dereuromark merged commit 7d9085a into master Mar 25, 2026
3 checks passed
@dereuromark dereuromark deleted the fix/toml-test-compliance branch March 25, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant