1
1
mirror of https://github.com/wader/fq.git synced 2024-11-27 14:14:58 +03:00
fq/pkg/interp/testdata/value_object.fqtest

124 lines
3.7 KiB
Plaintext
Raw Normal View History

$ 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{}:
2020-06-08 03:29:51 +03:00
0x0| 00 | . | unsynchronisation: false
0x0| 00 | . | extended_header: false
0x0| 00 | . | experimental_indicator: false
0x0| 00 | . | unused: 0
2021-08-12 00:51:00 +03:00
{
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
}
2020-06-08 03:29:51 +03:00
"object"
4
mp3> .headers[0].flags[0] | ., type, length?
2021-08-12 00:51:00 +03:00
error: expected an array with index 0 but got: object
mp3> .headers[0].flags[-1000] | ., type, length?
2021-08-12 00:51:00 +03:00
error: expected an array with index -2 but got: object
mp3> .headers[0].flags[1000] | ., type, length?
2021-08-12 00:51:00 +03:00
error: expected an array with index -1 but got: object
mp3> .headers[0].flags[1:3] | ., type, length?
2020-06-08 03:29:51 +03:00
error: expected an array but got: object
mp3> .headers[0].flags[0:-1] | ., type, length?
2020-06-08 03:29:51 +03:00
error: expected an array but got: object
mp3> .headers[0].flags[-1000:2000] | ., type, length?
2020-06-08 03:29:51 +03:00
error: expected an array but got: object
mp3> .headers[0].flags["test"] | ., type, length?
2020-06-08 03:29:51 +03:00
null
"null"
0
mp3> [.headers[0].flags[]] | type, length?
2020-06-08 03:29:51 +03:00
"array"
4
mp3> .headers[0].flags | keys
2020-06-08 03:29:51 +03:00
[
"unsynchronisation",
"extended_header",
"experimental_indicator",
"unused"
]
mp3> .headers[0].flags | has("a")
2020-06-08 03:29:51 +03:00
false
mp3> .headers[0].flags | has(0)
2020-06-08 03:29:51 +03:00
error: cannot check whether object has a key: 0
mp3> .headers[0].flags | type
2020-06-08 03:29:51 +03:00
"object"
mp3> .headers[0].flags | tonumber
2020-06-08 03:29:51 +03:00
error: tonumber cannot be applied to: object
mp3> .headers[0].flags | tostring
2020-06-08 03:29:51 +03:00
error: tostring cannot be applied to: object
mp3> .headers[0].flags + ""
2020-06-08 03:29:51 +03:00
error: cannot add: object ({"experimental_indicator" ...}) and string ("")
mp3> .headers[0].flags + 1
2020-06-08 03:29:51 +03:00
error: cannot add: object ({"experimental_indicator" ...}) and number (1)
mp3> .headers[0].flags._start | ., type, length?
2020-06-08 03:29:51 +03:00
40
"number"
40
mp3> .headers[0].flags._stop | ., type, length?
2020-06-08 03:29:51 +03:00
48
"number"
48
mp3> .headers[0].flags._len | ., type, length?
2020-06-08 03:29:51 +03:00
8
"number"
8
mp3> .headers[0].flags._name | ., type, length?
2020-06-08 03:29:51 +03:00
"flags"
"string"
5
mp3> .headers[0].flags._sym | ., type, length?
null
"null"
2020-06-08 03:29:51 +03:00
0
mp3> .headers[0].flags._description | ., type, length?
null
"null"
2020-06-08 03:29:51 +03:00
0
mp3> .headers[0].flags._path | ., type, length?
2020-06-08 03:29:51 +03:00
[
"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)
2020-06-08 03:29:51 +03:00
"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)
2020-06-08 03:29:51 +03:00
"buffer"
1
mp3>
mp3> .headers[0].flags._error | ., type, length?
2020-06-08 03:29:51 +03:00
null
"null"
0
mp3> .headers[0].flags._unknown | ., type, length?
2020-06-08 03:29:51 +03:00
false
"boolean"
mp3> .headers[0].flags.a = 1
error: update key a cannot be applied to: object
mp3> .headers[0].flags[0] = 1
error: expected an array with index 0 but got: object
mp3> .headers[0].flags.a |= empty
error: update key a cannot be applied to: 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: update key a cannot be applied to: object
mp3> .headers[0].flags | setpath([0]; 1)
error: update key 0 cannot be applied to: object
mp3> .headers[0].flags | delpaths([["a"]])
error: update key a cannot be applied to: object
mp3> .headers[0].flags | delpaths([[0]])
error: update key 0 cannot be applied to: object
mp3> ^D