1
1
mirror of https://github.com/wader/fq.git synced 2024-12-29 16:42:06 +03:00
fq/pkg/interp/testdata/value_string.fqtest

121 lines
3.0 KiB
Plaintext
Raw Normal View History

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