1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 22:05:31 +03:00
fq/format/toml/testdata/toml.fqtest
Mattias Wadman e3ae1440c9 interp: Rename to/from<format> functions to to_/from_<format>
Feels less cluttered, easier to read and more consistent.

Still keep tovalue, tobytes etc that are more basic functions this
only renamed format related functions.
Also there is an exceptin for to/fromjson as it comes from jq.

Also fixes lots of spelling errors while reading thru.
2022-12-21 17:48:39 +01: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 (to_toml | ., from_toml) catch .), "----"' variants.json
to_toml 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 '"" | from_toml'
exitcode: 5
stderr:
error: error at position 0x0: root object has no values