1
1
mirror of https://github.com/wader/fq.git synced 2024-11-24 03:05:22 +03:00
fq/pkg/interp/testdata/value_object.fqtest
2021-09-16 22:40:03 +02:00

125 lines
3.6 KiB
Plaintext

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