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
Mattias Wadman 1b32b42f93 decode: Major decode API refactor
Generate more code
More generic and comfortable API
Improve and Update format decoder to new API
Add some more format tests
2021-11-15 21:12:07 +01:00

124 lines
3.6 KiB
Plaintext

$ 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._sym | ., type, length?
null
"null"
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|0123456789abcdef|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
"buffer"
8
mp3>
mp3> .headers[0].flags._bytes | ., type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
"buffer"
1
mp3>
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