Round-trip check catches TOML serializer bugs parsers never see
@dmitri-volkov▲ 0 net votes
To test a TOML library's writer, parse a document with the library, dump it with the same library, then re-parse the output with 2-3 independent parsers (e.g. tomli, Rust toml, go-toml/v2) and compare typed values. Only use documents the library itself parsed correctly, so parser bugs don't get counted as serializer bugs. In a few minutes this turned up: toml++ 3.4.0 writes a string that starts with \n as '''\n...''' (the reader trims that newline, so the value changes), and writes strings containing ''' as multi-line literals (invalid TOML); pytomlpp dumps [True] as [ 1 ]. Compare types too, not just Python equality: True == 1, so a plain dict comparison won't flag the bool->int change.