just buildorgleam buildcompiles the package.just testrunsgleam testplus the upstream TOML corpus checks.gleam testruns the Gleam unit tests only.gleam test --target javascriptruns the unit tests on the JavaScript target.python3 scripts/run_corpus_tests.py validruns only valid TOML corpus checks.python3 scripts/run_corpus_tests.py invalidruns only invalid TOML corpus checks.python3 scripts/run_corpus_tests.pyruns all corpus checks.just formatrunsgleam format src test.just lintrunsgleam format --check src test.just docsrunsgleam docs build.just ciorjust prruns format, lint, test, build, and docs.
Gleeunit discovers every public function ending in _test under test/. It does
not expose a built-in name filter. For a single Erlang-target test after test
beams have been compiled, run:
erl -noshell -pa build/dev/erlang/*/ebin -eval 'case eunit:test({'"'"'tomlet@parser_test'"'"', parse_booleans_test}, [verbose]) of ok -> halt(0); error -> halt(1) end.'Replace tomlet@parser_test and parse_booleans_test with the module and test
function you want.
Tomlet is a round-tripping TOML parser and writer for Gleam. The public API is
the top-level tomlet module. Document is opaque and stores an internal
tomlet/ast.Table, trailing trivia, original line-ending style, and the original
source when available so unedited parsed documents can round-trip exactly.
The internal modules listed in gleam.toml are implementation details:
tomlet/astdefines the trivia-preserving syntax tree, including source text for values that must preserve lexical representation.tomlet/parserparses normalized LF text into the internal AST, detects duplicate keys, validates TOML syntax, and reports byte offsets.tomlet/pathresolves key paths across root keys, standard tables, dotted keys, inline tables, nested inline tables, and arrays of tables.
The top-level tomlet module converts internal AST values into stable public
mirror types before returning them, maps internal parser errors to stable public
ParseError variants, and keeps edit operations checked through
Result(Document, EditError).
Corpus checks are generated by scripts/run_corpus_tests.py. It clones
toml-lang/toml-test into .toml-test/, writes temporary Gleam test modules for
valid and invalid TOML 1.0 fixtures, runs both Erlang and JavaScript targets, and
removes generated files afterward. Valid fixtures are expected to round-trip
byte-for-byte unless explicitly listed in ROUNDTRIP_UNSUPPORTED.
- Keep all supported user-facing API in
src/tomlet.gleam; do not expose or documenttomlet/ast,tomlet/parser, ortomlet/pathas public API unless intentionally changing the release boundary. - Public variant types in
tomlet.gleamare semver-stable and matchable. Adding, removing, or renaming variants is a breaking change. - Convert internal AST values to public
tomlet.Valuevariants before exposing them. - Preserve round-trip behavior: unedited parsed documents return their original source, edits preserve nearby comments, key order, trivia, and CRLF/LF style.
- Keep date, time, and datetime public types opaque; expose lexical forms through
*_to_stringhelpers. - Inline table edits may replace existing nested values, but inserting missing
nested keys inside an existing inline table returns
InlineTableInsertUnsupported. - Parse byte input with
parse_byteswhen UTF-8 or BOM validation matters. Invalid byte encodings should be rejected withInvalidEncoding. - User-facing changes should include a Changie fragment in
.changes/unreleased/using the labels configured in.changie.yaml.