1
1
mirror of https://github.com/wader/fq.git synced 2024-12-29 16:42:06 +03:00
fq/pkg/interp/testdata/var.fqtest
2021-09-16 22:40:03 +02:00

54 lines
1.4 KiB
Plaintext

/test.mp3:
$ fq -ni
null> 123 | var("a")
null> "bb" | var("bb")
null> var
{
"a": 123,
"bb": "bb"
}
null> $a
123
null> "aa" | var("a")
null> var
{
"a": "aa",
"bb": "bb"
}
null> $a
"aa"
null> var("a"; empty)
null> $a
error: repl:1:0: variable not defined: $a
null> var
{
"bb": "bb"
}
null> . | repl
> null> $bb
"bb"
> null> ^D
null> var("bb"; empty)
null> var
{}
null> 123 | var("a b")
error: invalid variable name: a b
null> 123 | var(null)
error: invalid variable name: null
null> ^D
$ fq -d mp3 -i . /test.mp3
mp3> .frames[0] | var("f")
mp3> $f
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.frames[0]: {} (mp3_frame)
0x20| ff fb 40| ..@| header: {}
0x30|c0 |. |
0x30| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00| ...............| side_info: {}
0x40|00 00 |.. |
0x40| 49 6e 66 6f 00 00 00 0f 00 00 00 02 00 00| Info..........| xing: {} (xing)
0x50|02 57 00 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6 a6|.W..............|
* |until 0xdd.7 (156) | |
0xd0| 00 00| ..| padding: 0000000000
0xe0|00 00 00 |... |
| | | crc_calculated: 827a
mp3> ^D