You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
encoding/toml: validate the resulting value against toml.Unmarshal
Given some input TOML, we can use our new encoding/toml.Decoder
to obtain an ast.Node and then compile that to a cue.Value.
Similarly, we can use go-toml's Unmarshal API on the same input TOML
to obtain a Go value directly.
Those two values should be equivalent, which we check via qt.JSONEquals.
Two test cases fail this new check: the one involving duplicate keys,
which is a known bug in our decoder, and the pair of tests involving
empty TOML input, which we decoded as a CUE null.
It seems like all TOML decoders decode empty input as an empty struct,
and the TOML spec also hints that way as it allows empty tables
which "simply have no key/value pairs within them".
Moreover, since we create an ast.File, it seems best to leave it empty,
which equals an empty struct, rather than add a "null" embedding.
While here, add a TODO to remind myself to revisit literal decoding.
Updates #68.
Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I83e34b939f1c2dd3b7928e14076f69c39e5054e0
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194706
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
0 commit comments