1
1
mirror of https://github.com/wader/fq.git synced 2024-11-28 03:02:55 +03:00
fq/pkg/interp/testdata/value_number.fqtest
Mattias Wadman 0c7fa090b0 gojq: Initial update support
decode value give no updateable error
JQValue json value tries to replicate behaveior
2021-09-12 13:08:50 +02:00

109 lines
3.1 KiB
Plaintext

/test.mp3:
$ fq -i -d mp3 . /test.mp3
mp3> .headers[0].version | ., tovalue, type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
0x0| 04 | . |.headers[0].version: 4
4
"number"
4
mp3> .headers[0].version[0] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version[-1000] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version[1000] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version[1:3] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version[0:-1] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version[-1000:2000] | ., type, length?
error: expected an array but got: number
mp3> .headers[0].version["test"] | ., type, length?
error: expected an object but got: number
mp3> [.headers[0].version[]] | type, length?
error: cannot iterate over: number
mp3> .headers[0].version | keys
error: keys cannot be applied to: number
mp3> .headers[0].version | has("a")
error: has cannot be applied to: number
mp3> .headers[0].version | has(0)
error: has cannot be applied to: number
mp3> .headers[0].version | type
"number"
mp3> .headers[0].version | tonumber
4
mp3> .headers[0].version | tostring
"4"
mp3> .headers[0].version + ""
error: cannot add: number (4) and string ("")
mp3> .headers[0].version + 1
5
mp3> .headers[0].version._start | ., type, length?
24
"number"
24
mp3> .headers[0].version._stop | ., type, length?
32
"number"
32
mp3> .headers[0].version._len | ., type, length?
8
"number"
8
mp3> .headers[0].version._name | ., type, length?
"version"
"string"
7
mp3> .headers[0].version._symbol | ., type, length?
""
"string"
0
mp3> .headers[0].version._description | ., type, length?
""
"string"
0
mp3> .headers[0].version._path | ., type, length?
[
"headers",
0,
"version"
]
"array"
3
mp3> .headers[0].version._bits | ., type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
0x0|04 |. |
<8 bits>
"buffer"
8
mp3> .headers[0].version._bytes | ., type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
0x0|04 |. |
<1 bytes>
"buffer"
1
mp3> .headers[0].version._error | ., type, length?
null
"null"
0
mp3> .headers[0].version._unknown | ., type, length?
false
"boolean"
mp3> .headers[0].version.a = 1
error: expected an object but got: number
mp3> .headers[0].version[0] = 1
error: expected an array but got: number
mp3> .headers[0].version.a |= empty
error: expected an object but got: number
mp3> .headers[0].version[0] |= empty
error: expected an array but got: number
mp3> .headers[0].version | setpath(["a"]; 1)
error: expected an object with key "a" but got: number
mp3> .headers[0].version | setpath([0]; 1)
error: expected an array with index 0 but got: number
mp3> .headers[0].version | delpaths([["a"]])
error: expected an object with key "a" but got: number
mp3> .headers[0].version | delpaths([[0]])
error: expected an array with index 0 but got: number
mp3> ^D