tomland
tomland copied to clipboard
[Testing] Encode . decode test property
Encode . decode
property-based testing is done on every data type in TOML, but there is an issue involving non-ascii characters (Δ, ΕΎ, Ρ, Ρ). The reason why that test fails for them is that those characters are converted into \Uxxxxxxxx
and during the decode phase, they are not decoded back.
The solution to this problem can be resolved in two ways:
- change decoding phase to turn
\Uxxxxxxxx
into regular characters - change equal function that will say that
Δ
is equal to\U0000010d
I am a fan of the second approach because semantically speaking those two characters should be equal. I have already added some non-ascii characters to the test file, but I am not referring it to it anywhere in the code, as you can see down there. https://github.com/kowainik/tomland/blob/ee5b8facf71d79b482a80bce3d6de4dce3638d87/test/Test/Toml/Gen.hs#L304-L318