1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 21:31:33 +03:00
fq/format/toml/testdata/toml.fqtest
Mattias Wadman cae288e6be format,intepr: Refactor json, yaml, etc into formats also move out related functions
json, yaml, toml, xml, html, csv are now normal formats and most of them also particiate
in probing (not html and csv).

Also fixes a bunch of bugs in to/fromxml, to/fromjq etc.
2022-07-23 21:48:45 +02:00

72 lines
1.3 KiB
Plaintext

/probe.toml:
[test]
key = 123
$ fq . probe.toml
{
"test": {
"key": 123
}
}
# toml does not support null in arrays
# TODO: add uint64 norm test
$ fq -rRs 'fromjson[] | (walk(if type == "array" then map(select(. != null)) end) | try (totoml | ., fromtoml) catch .), "----"' variants.json
totoml cannot be applied to: null
----
toml: top-level values must be Go maps or structs
----
toml: top-level values must be Go maps or structs
----
toml: top-level values must be Go maps or structs
----
toml: top-level values must be Go maps or structs
----
toml: top-level values must be Go maps or structs
----
toml: top-level values must be Go maps or structs
----
array = [true, false, 1.2, "string", [1.2, 3], {a = 1}]
"escape \\\"" = 456
false = false
number = 1.2
string = "string"
true = true
"white space" = 123
[object]
a = 1
{
"array": [
true,
false,
1.2,
"string",
[
1.2,
3
],
{
"a": 1
}
],
"escape \\\"": 456,
"false": false,
"number": 1.2,
"object": {
"a": 1
},
"string": "string",
"true": true,
"white space": 123
}
----
toml: top-level values must be Go maps or structs
----
error at position 0x0: root object has no values
----
$ fq -n '"" | fromtoml'
exitcode: 5
stderr:
error: error at position 0x0: root object has no values