mirror of
https://github.com/wader/fq.git
synced 2024-12-23 13:22:58 +03:00
cli: Add completion tests
This commit is contained in:
parent
60df04b098
commit
8dc0f06b62
2
format/flac/testdata/frame.fqtest
vendored
2
format/flac/testdata/frame.fqtest
vendored
@ -1,7 +1,7 @@
|
||||
# test decode separate frame
|
||||
# ffmpeg -f lavfi -i sine -t 0.01s -f flac pipe:1 | fq - '.frames[0]._bytes' > frame
|
||||
/frame:
|
||||
> fq -d flac_frame verbose /frame
|
||||
$ fq -d flac_frame verbose /frame
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /frame (flac_frame) 0x0-0x1ff.7 (512)
|
||||
| | | header: {} 0x0-0x7.7 (8)
|
||||
0x000|ff f8 |.. | sync: Correct (0x3ffe) 0x0-0x1.5 (1.6)
|
||||
|
2
format/flac/testdata/mono16.fqtest
vendored
2
format/flac/testdata/mono16.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/mono16.flac:
|
||||
> fq -d flac verbose /mono16.flac
|
||||
$ fq -d flac verbose /mono16.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mono16.flac (flac) 0x0-0x8597.7 (34200)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x206f.7 (8300)
|
||||
|
2
format/flac/testdata/mono24.fqtest
vendored
2
format/flac/testdata/mono24.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/mono24.flac:
|
||||
> fq -d flac verbose /mono24.flac
|
||||
$ fq -d flac verbose /mono24.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mono24.flac (flac) 0x0-0xbcca.7 (48331)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x209b.7 (8344)
|
||||
|
2
format/flac/testdata/mono8.fqtest
vendored
2
format/flac/testdata/mono8.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/mono8.flac:
|
||||
> fq -d flac verbose /mono8.flac
|
||||
$ fq -d flac verbose /mono8.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mono8.flac (flac) 0x0-0x4cef.7 (19696)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x206f.7 (8300)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/picture_seek_gain.flac:
|
||||
> fq -d flac verbose /picture_seek_gain.flac
|
||||
$ fq -d flac verbose /picture_seek_gain.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /picture_seek_gain.flac (flac) 0x0-0x225f.7 (8800)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [5] 0x4-0x205f.7 (8284)
|
||||
|
2
format/flac/testdata/stereo16.fqtest
vendored
2
format/flac/testdata/stereo16.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/stereo16.flac:
|
||||
> fq -d flac verbose /stereo16.flac
|
||||
$ fq -d flac verbose /stereo16.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /stereo16.flac (flac) 0x0-0xc54b.7 (50508)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x206f.7 (8300)
|
||||
|
2
format/flac/testdata/stereo24.fqtest
vendored
2
format/flac/testdata/stereo24.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/stereo24.flac:
|
||||
> fq -d flac verbose /stereo24.flac
|
||||
$ fq -d flac verbose /stereo24.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /stereo24.flac (flac) 0x0-0x11bcb.7 (72652)
|
||||
0x00000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x209b.7 (8344)
|
||||
|
2
format/flac/testdata/stereo8.fqtest
vendored
2
format/flac/testdata/stereo8.fqtest
vendored
@ -1,5 +1,5 @@
|
||||
/stereo8.flac:
|
||||
> fq -d flac verbose /stereo8.flac
|
||||
$ fq -d flac verbose /stereo8.flac
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /stereo8.flac (flac) 0x0-0x6d5c.7 (27997)
|
||||
0x0000|66 4c 61 43 |fLaC | magic: "fLaC" (Correct) 0x0-0x3.7 (4)
|
||||
| | | metadatablocks: [4] 0x4-0x206f.7 (8300)
|
||||
|
2
format/gif/testdata/4x4.fqtest
vendored
2
format/gif/testdata/4x4.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# gm convert -size 4x4 'xc:#000' 'xc:#fff' 4x4.gif
|
||||
/4x4.gif:
|
||||
> fq -d gif verbose /4x4.gif
|
||||
$ fq -d gif verbose /4x4.gif
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4.gif (gif) 0x0-0x5e.7 (95)
|
||||
0x00|47 49 46 38 39 61 |GIF89a | header: "GIF89a" (Correct) 0x0-0x5.7 (6)
|
||||
0x00| 04 00 | .. | width: 4 0x6-0x7.7 (2)
|
||||
|
2
format/gzip/testdata/test.fqtest
vendored
2
format/gzip/testdata/test.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# echo test | gzip -N > test.gz
|
||||
/test.gz:
|
||||
> fq -d gzip verbose /test.gz
|
||||
$ fq -d gzip verbose /test.gz
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.gz (gzip) 0x0-0x18.7 (25)
|
||||
0x00|1f 8b |.. | identification: "\x1f\x8b" (Correct) 0x0-0x1.7 (2)
|
||||
0x0|74 65 73 74 0a| |test.| | uncompressed: 746573740a 0x0-0x4.7 (5)
|
||||
|
2
format/icc/testdata/sRGB2014.fqtest
vendored
2
format/icc/testdata/sRGB2014.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# sRGB2014.icc is from https://www.color.org/srgbprofiles.xalter
|
||||
/sRGB2014.icc:
|
||||
> fq -d icc_profile verbose /sRGB2014.icc
|
||||
$ fq -d icc_profile verbose /sRGB2014.icc
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /sRGB2014.icc (icc_profile) 0x0-0xbcf.7 (3024)
|
||||
| | | header: {} 0x0-0x7f.7 (128)
|
||||
0x000|00 00 0b d0 |.... | size: 3024 0x0-0x3.7 (4)
|
||||
|
2
format/id3/testdata/apic.fqtest
vendored
2
format/id3/testdata/apic.fqtest
vendored
@ -1,7 +1,7 @@
|
||||
# ffmpeg -f lavfi -i anullsrc=d=10ms -f lavfi -i testsrc=s=4x4:r=1:d=1 -map 0:0 -map 1:0 -f mp3 test.mp3
|
||||
# fq test.mp3 '.. | select(._format == "id3v2")?._bytes' > apic
|
||||
/apic:
|
||||
> fq -d id3v2 verbose /apic
|
||||
$ fq -d id3v2 verbose /apic
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /apic (id3v2) 0x0-0xb3.7 (180)
|
||||
0x00|49 44 33 |ID3 | magic: "ID3" (Correct) 0x0-0x2.7 (3)
|
||||
0x00| 04 | . | version: 4 0x3-0x3.7 (1)
|
||||
|
2
format/id3/testdata/id3v1.fqtest
vendored
2
format/id3/testdata/id3v1.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -write_id3v1 1 -metadata title=test -f mp3 pipe:1 | fq - '.footers[0]._bytes' > id3v1
|
||||
/id3v1:
|
||||
> fq -d id3v1 verbose /id3v1
|
||||
$ fq -d id3v1 verbose /id3v1
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /id3v1 (id3v1) 0x0-0x7f.7 (128)
|
||||
0x00|54 41 47 |TAG | magic: "TAG" (Correct) 0x0-0x2.7 (3)
|
||||
0x00| 74 65 73 74 00 00 00 00 00 00 00 00 00| test.........| song_name: "test" 0x3-0x20.7 (30)
|
||||
|
2
format/id3/testdata/id3v23.fqtest
vendored
2
format/id3/testdata/id3v23.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 0s -id3v2_version 3 -f mp3 pipe:1 > id3v23
|
||||
/id3v23:
|
||||
> fq -d id3v2 verbose /id3v23
|
||||
$ fq -d id3v2 verbose /id3v23
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /id3v23 (id3v2) 0x0-0x2c.7 (45)
|
||||
0x00|49 44 33 |ID3 | magic: "ID3" (Correct) 0x0-0x2.7 (3)
|
||||
0x00| 03 | . | version: 3 0x3-0x3.7 (1)
|
||||
|
2
format/id3/testdata/id3v24.fqtest
vendored
2
format/id3/testdata/id3v24.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 0s -id3v2_version 4 -f mp3 pipe:1 > id3v24
|
||||
/id3v24:
|
||||
> fq -d id3v2 verbose /id3v24
|
||||
$ fq -d id3v2 verbose /id3v24
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /id3v24 (id3v2) 0x0-0x2c.7 (45)
|
||||
0x00|49 44 33 |ID3 | magic: "ID3" (Correct) 0x0-0x2.7 (3)
|
||||
0x00| 04 | . | version: 4 0x3-0x3.7 (1)
|
||||
|
2
format/id3/testdata/utf16-apic.fqtest
vendored
2
format/id3/testdata/utf16-apic.fqtest
vendored
@ -3,7 +3,7 @@
|
||||
# eyeD3 --encoding=utf16 --add-image=4x4.png:OTHER:test test.mp3
|
||||
# fq test.mp3 .headers[0]._bits > utf16-apic
|
||||
/utf16-apic:
|
||||
> fq -d id3v2 verbose /utf16-apic
|
||||
$ fq -d id3v2 verbose /utf16-apic
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /utf16-apic (id3v2) 0x0-0x255.7 (598)
|
||||
0x000|49 44 33 |ID3 | magic: "ID3" (Correct) 0x0-0x2.7 (3)
|
||||
0x000| 04 | . | version: 4 0x3-0x3.7 (1)
|
||||
|
2
format/jpeg/testdata/4x4.fqtest
vendored
2
format/jpeg/testdata/4x4.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# gm convert -size 4x4 'xc:#000' 4x4.jpg
|
||||
/4x4.jpg:
|
||||
> fq -d jpeg verbose /4x4.jpg
|
||||
$ fq -d jpeg verbose /4x4.jpg
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4.jpg (jpeg) 0x0-0x9f.7 (160)
|
||||
| | | segments: [9] 0x0-0x9f.7 (160)
|
||||
| | | [0]: marker {} 0x0-0x1.7 (2)
|
||||
|
14
format/json/testdata/json.fqtest
vendored
14
format/json/testdata/json.fqtest
vendored
@ -1,9 +1,9 @@
|
||||
/test.json:
|
||||
/json.gz:
|
||||
> fq -d json . /test.json
|
||||
$ fq -d json . /test.json
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
| | |.: {} /test.json (json)
|
||||
> fq -d json tovalue /test.json
|
||||
$ fq -d json tovalue /test.json
|
||||
{
|
||||
"a": 123,
|
||||
"b": [
|
||||
@ -15,12 +15,12 @@
|
||||
"d": null,
|
||||
"e": 123.4
|
||||
}
|
||||
> fq . /test.json
|
||||
$ fq . /test.json
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
| | |.: {} /test.json (json)
|
||||
> fq .b[1] /test.json
|
||||
$ fq .b[1] /test.json
|
||||
2
|
||||
> fq . /json.gz
|
||||
$ fq . /json.gz
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /json.gz (gzip)
|
||||
0x00|1f 8b |.. | identification: "\x1f\x8b" (Correct)
|
||||
0x0|7b 22 61 22 3a 20 31 32 33 7d |{"a": 123} | uncompressed: {} (json)
|
||||
@ -33,7 +33,7 @@
|
||||
0x10|30 34 32 ae e5 02 00 |042.... |
|
||||
0x10| 20 ac d2 9c | ... | crc32: Correct (9cd2ac20)
|
||||
0x10| 0b 00 00 00| | ....|| isize: 11
|
||||
> fq tovalue /json.gz
|
||||
$ fq tovalue /json.gz
|
||||
{
|
||||
"compressed": "<13>q1ZKVLJSMDQyruUCAA==",
|
||||
"compression_method": 8,
|
||||
@ -55,6 +55,6 @@
|
||||
"a": 123
|
||||
}
|
||||
}
|
||||
> fq .uncompressed /json.gz
|
||||
$ fq .uncompressed /json.gz
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
| | |.uncompressed: {} (json)
|
||||
|
2
format/matroska/testdata/aac.fqtest
vendored
2
format/matroska/testdata/aac.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -c:a aac -f matroska -t 50ms aac.mkv
|
||||
/aac.mkv:
|
||||
> fq -d matroska verbose /aac.mkv
|
||||
$ fq -d matroska verbose /aac.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /aac.mkv (matroska) 0x0-0x4c3.7 (1220)
|
||||
| | | elements: [2] 0x0-0x4c3.7 (1220)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/av1.fqtest
vendored
2
format/matroska/testdata/av1.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -g 1 -c:v librav1e -t 50ms av1.mkv
|
||||
/av1.mkv:
|
||||
> fq -d matroska verbose /av1.mkv
|
||||
$ fq -d matroska verbose /av1.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /av1.mkv (matroska) 0x0-0x13e6.7 (5095)
|
||||
| | | elements: [2] 0x0-0x13e6.7 (5095)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/avc.fqtest
vendored
2
format/matroska/testdata/avc.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v h264 -f matroska -t 50ms avc.mkv
|
||||
/avc.mkv:
|
||||
> fq -d matroska verbose /avc.mkv
|
||||
$ fq -d matroska verbose /avc.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /avc.mkv (matroska) 0x0-0xd46.7 (3399)
|
||||
| | | elements: [2] 0x0-0xd46.7 (3399)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/flac.fqtest
vendored
2
format/matroska/testdata/flac.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -ac 2 -c:a flac -strict experimental -f matroska -t 50ms flac.mkv
|
||||
/flac.mkv:
|
||||
> fq -d matroska verbose /flac.mkv
|
||||
$ fq -d matroska verbose /flac.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /flac.mkv (matroska) 0x0-0x4ce.7 (1231)
|
||||
| | | elements: [2] 0x0-0x4ce.7 (1231)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/hevc.fqtest
vendored
2
format/matroska/testdata/hevc.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v hevc -f matroska -t 50ms hevc.mkv
|
||||
/hevc.mkv:
|
||||
> fq -d matroska verbose /hevc.mkv
|
||||
$ fq -d matroska verbose /hevc.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /hevc.mkv (matroska) 0x0-0x13ea.7 (5099)
|
||||
| | | elements: [2] 0x0-0x13ea.7 (5099)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/mp3.fqtest
vendored
2
format/matroska/testdata/mp3.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -c:a mp3 -f matroska -t 50ms mp3.mkv
|
||||
/mp3.mkv:
|
||||
> fq -d matroska verbose /mp3.mkv
|
||||
$ fq -d matroska verbose /mp3.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mp3.mkv (matroska) 0x0-0x4db.7 (1244)
|
||||
| | | elements: [2] 0x0-0x4db.7 (1244)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/mpeg2.fqtest
vendored
2
format/matroska/testdata/mpeg2.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v mpeg2video -f matroska -t 50ms mpeg2.mkv
|
||||
/mpeg2.mkv:
|
||||
> fq -d matroska verbose /mpeg2.mkv
|
||||
$ fq -d matroska verbose /mpeg2.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mpeg2.mkv (matroska) 0x0-0x21c9.7 (8650)
|
||||
| | | elements: [2] 0x0-0x21c9.7 (8650)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/opus.fqtest
vendored
2
format/matroska/testdata/opus.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -strict experimental -c:a opus -f matroska -t 50ms opus.mkv
|
||||
/opus.mkv:
|
||||
> fq -d matroska verbose /opus.mkv
|
||||
$ fq -d matroska verbose /opus.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /opus.mkv (matroska) 0x0-0x3ec.7 (1005)
|
||||
| | | elements: [2] 0x0-0x3ec.7 (1005)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
4
format/matroska/testdata/path.fqtest
vendored
4
format/matroska/testdata/path.fqtest
vendored
@ -1,10 +1,10 @@
|
||||
/avc.mkv:
|
||||
> fq -d matroska 'matroska_path(".Segment.Tracks[0].TrackEntry[0].CodecID")' /avc.mkv
|
||||
$ fq -d matroska 'matroska_path(".Segment.Tracks[0].TrackEntry[0].CodecID")' /avc.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.elements[1].elements[3].elements[1].elements[4]: {}
|
||||
| | | type: string (3)
|
||||
0x150| 86 | . | id: CodecID (0x86)
|
||||
0x150| 8f | . | size: 15
|
||||
0x150| 56 5f 4d 50 45 47 34 2f 49 53 4f 2f| V_MPEG4/ISO/| value: "V_MPEG4/ISO/AVC"
|
||||
0x160|41 56 43 |AVC |
|
||||
> fq -d matroska 'matroska_path(matroska_path(".Segment.Tracks[0].TrackEntry[0].CodecID"))' /avc.mkv
|
||||
$ fq -d matroska 'matroska_path(matroska_path(".Segment.Tracks[0].TrackEntry[0].CodecID"))' /avc.mkv
|
||||
".Segment.Tracks.TrackEntry.CodecID"
|
||||
|
2
format/matroska/testdata/vorbis.fqtest
vendored
2
format/matroska/testdata/vorbis.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -ac 2 -strict experimental -c:a vorbis -f matroska -t 50ms vorbis.mkv
|
||||
/vorbis.mkv:
|
||||
> fq -d matroska verbose /vorbis.mkv
|
||||
$ fq -d matroska verbose /vorbis.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis.mkv (matroska) 0x0-0x10fa.7 (4347)
|
||||
| | | elements: [2] 0x0-0x10fa.7 (4347)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/vp8.fqtest
vendored
2
format/matroska/testdata/vp8.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v vp8 -f matroska -t 50ms vp8.mkv
|
||||
/vp8.mkv:
|
||||
> fq -d matroska verbose /vp8.mkv
|
||||
$ fq -d matroska verbose /vp8.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vp8.mkv (matroska) 0x0-0x148b.7 (5260)
|
||||
| | | elements: [2] 0x0-0x148b.7 (5260)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
2
format/matroska/testdata/vp9.fqtest
vendored
2
format/matroska/testdata/vp9.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v vp9 -f matroska -t 50ms vp9.mkv
|
||||
/vp9.mkv:
|
||||
> fq -d matroska verbose /vp9.mkv
|
||||
$ fq -d matroska verbose /vp9.mkv
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vp9.mkv (matroska) 0x0-0x1785.7 (6022)
|
||||
| | | elements: [2] 0x0-0x1785.7 (6022)
|
||||
| | | [0]: element {} 0x0-0x27.7 (40)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f mp3 pipe:1 | fq - '.headers._bytes, ("\x00\x00\x00" | bytes), .frames[0]._bytes' > header-zeros-frames.mp3
|
||||
/header-zeros-frames.mp3:
|
||||
> fq -d mp3 verbose /header-zeros-frames.mp3
|
||||
$ fq -d mp3 verbose /header-zeros-frames.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /header-zeros-frames.mp3 (mp3) 0x0-0xff.7 (256)
|
||||
| | | headers: [1] 0x0-0x2c.7 (45)
|
||||
| | | [0]: header {} (id3v2) 0x0-0x2c.7 (45)
|
||||
|
2
format/mp3/testdata/headerfooter.fqtest
vendored
2
format/mp3/testdata/headerfooter.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 1ms -write_xing 0 -write_id3v2 4 -write_id3v1 1 -metadata title=test -f mp3 headerfooter.mp3
|
||||
/headerfooter.mp3:
|
||||
> fq -d mp3 verbose /headerfooter.mp3
|
||||
$ fq -d mp3 verbose /headerfooter.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /headerfooter.mp3 (mp3) 0x0-0x25d.7 (606)
|
||||
| | | headers: [1] 0x0-0x3c.7 (61)
|
||||
| | | [0]: header {} (id3v2) 0x0-0x3c.7 (61)
|
||||
|
4
format/mp3/testdata/test.fqtest
vendored
4
format/mp3/testdata/test.fqtest
vendored
@ -1,8 +1,8 @@
|
||||
/test.mp3:
|
||||
> fq -d mp3 '.headers[0].magic | verbose' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | verbose' /test.mp3
|
||||
|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) 0x0-0x2.7 (3)
|
||||
> fq -d mp3 verbose /test.mp3
|
||||
$ fq -d mp3 verbose /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.mp3 (mp3) 0x0-0x452.7 (1107)
|
||||
| | | headers: [1] 0x0-0x3b.7 (60)
|
||||
| | | [0]: header {} (id3v2) 0x0-0x3b.7 (60)
|
||||
|
2
format/mp3/testdata/xing.fqtest
vendored
2
format/mp3/testdata/xing.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -f lavfi -i sine -ac 2 -t 10ms -f mp3 temp.mp3 && fq temp.mp3 '.frame[0].xing | bits' > xing
|
||||
/xing:
|
||||
> fq -d xing verbose /xing
|
||||
$ fq -d xing verbose /xing
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /xing (xing) 0x0-0x9b.7 (156)
|
||||
0x00|49 6e 66 6f |Info | header: "Info" 0x0-0x3.7 (4)
|
||||
| | | present_flags: {} 0x4-0x7.7 (4)
|
||||
|
2
format/mp4/testdata/aac.fqtest
vendored
2
format/mp4/testdata/aac.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -c:a aac -f mp4 -t 50ms aac.mp4
|
||||
/aac.mp4:
|
||||
> fq -d mp4 verbose /aac.mp4
|
||||
$ fq -d mp4 verbose /aac.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /aac.mp4 (mp4) 0x0-0x59c.7 (1437)
|
||||
| | | boxes: [4] 0x0-0x59c.7 (1437)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/av1.fqtest
vendored
2
format/mp4/testdata/av1.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -v trace -f lavfi -i testsrc -c:v librav1e -t 50ms av1.mp4
|
||||
/av1.mp4:
|
||||
> fq -d mp4 verbose /av1.mp4
|
||||
$ fq -d mp4 verbose /av1.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /av1.mp4 (mp4) 0x0-0x14b1.7 (5298)
|
||||
| | | boxes: [4] 0x0-0x14b1.7 (5298)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/avc.fqtest
vendored
2
format/mp4/testdata/avc.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v h264 -f mp4 -t 50ms avc.mp4
|
||||
/avc.mp4:
|
||||
> fq -d mp4 verbose /avc.mp4
|
||||
$ fq -d mp4 verbose /avc.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /avc.mp4 (mp4) 0x0-0xdf2.7 (3571)
|
||||
| | | boxes: [4] 0x0-0xdf2.7 (3571)
|
||||
| | | [0]: box {} 0x0-0x1f.7 (32)
|
||||
|
2
format/mp4/testdata/flac.fqtest
vendored
2
format/mp4/testdata/flac.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -ac 2 -c:a flac -strict experimental -f mp4 -t 50ms flac.mp4
|
||||
/flac.mp4:
|
||||
> fq -d mp4 verbose /flac.mp4
|
||||
$ fq -d mp4 verbose /flac.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /flac.mp4 (mp4) 0x0-0x542.7 (1347)
|
||||
| | | boxes: [4] 0x0-0x542.7 (1347)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/fragmented.fqtest
vendored
2
format/mp4/testdata/fragmented.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -f lavfi -i testsrc -g 1 -c:a aac -c:v h264 -f mp4 -movflags +global_sidx+frag_keyframe+empty_moov -t 100ms fragmented.mp4
|
||||
/fragmented.mp4:
|
||||
> fq -d mp4 verbose /fragmented.mp4
|
||||
$ fq -d mp4 verbose /fragmented.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /fragmented.mp4 (mp4) 0x0-0x2bb3.7 (11188)
|
||||
| | | boxes: [11] 0x0-0x2bb3.7 (11188)
|
||||
| | | [0]: box {} 0x0-0x23.7 (36)
|
||||
|
2
format/mp4/testdata/heic.fqtest
vendored
2
format/mp4/testdata/heic.fqtest
vendored
@ -1,7 +1,7 @@
|
||||
# ffmpeg -f lavfi -i testsrc=size=16x16:r=1 -preset slower -r 1 -t 1s -pix_fmt yuv420p -f hevc heic.hvc
|
||||
# MP4Box -add-image heic.hvc -ab heic -new heic.mp4
|
||||
/heic.mp4:
|
||||
> fq -d mp4 verbose /heic.mp4
|
||||
$ fq -d mp4 verbose /heic.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /heic.mp4 (mp4) 0x0-0xb2c.7 (2861)
|
||||
| | | boxes: [4] 0x0-0xb2c.7 (2861)
|
||||
| | | [0]: box {} 0x0-0x17.7 (24)
|
||||
|
2
format/mp4/testdata/hevc.fqtest
vendored
2
format/mp4/testdata/hevc.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v hevc -f mp4 -t 50ms hevc.mp4
|
||||
/hevc.mp4:
|
||||
> fq -d mp4 verbose /hevc.mp4
|
||||
$ fq -d mp4 verbose /hevc.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /hevc.mp4 (mp4) 0x0-0x149a.7 (5275)
|
||||
| | | boxes: [4] 0x0-0x149a.7 (5275)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/mp3.fqtest
vendored
2
format/mp4/testdata/mp3.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -c:a mp3 -f mp4 -t 50ms mp3.mp4
|
||||
/mp3.mp4:
|
||||
> fq -d mp4 verbose /mp3.mp4
|
||||
$ fq -d mp4 verbose /mp3.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mp3.mp4 (mp4) 0x0-0x564.7 (1381)
|
||||
| | | boxes: [4] 0x0-0x564.7 (1381)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/mpeg2.fqtest
vendored
2
format/mp4/testdata/mpeg2.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v mpeg2video -f mp4 -t 50ms mpeg2.mp4
|
||||
/mpeg2.mp4:
|
||||
> fq -d mp4 verbose /mpeg2.mp4
|
||||
$ fq -d mp4 verbose /mpeg2.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mpeg2.mp4 (mp4) 0x0-0x22a8.7 (8873)
|
||||
| | | boxes: [4] 0x0-0x22a8.7 (8873)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/opus.fqtest
vendored
2
format/mp4/testdata/opus.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -strict experimental -c:a opus -t 50ms opus.mp4
|
||||
/opus.mp4:
|
||||
> fq -d mp4 verbose /opus.mp4
|
||||
$ fq -d mp4 verbose /opus.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /opus.mp4 (mp4) 0x0-0x438.7 (1081)
|
||||
| | | boxes: [4] 0x0-0x438.7 (1081)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
4
format/mp4/testdata/path.fqtest
vendored
4
format/mp4/testdata/path.fqtest
vendored
@ -1,10 +1,10 @@
|
||||
/fragmented.mp4:
|
||||
> fq -d mp4 'mp4_path(".moov.trak[1]")' /fragmented.mp4
|
||||
$ fq -d mp4 'mp4_path(".moov.trak[1]")' /fragmented.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.boxes[1].boxes[2]: {}
|
||||
0x280| 00 00 01 bf | .... | size: 447
|
||||
0x280| 74 72 61 6b | trak | type: "trak" (Container for an individual track or stream)
|
||||
0x280| 00 00 00 5c| ...\| boxes: [2]
|
||||
0x290|74 6b 68 64 00 00 00 03 00 00 00 00 00 00 00 00|tkhd............|
|
||||
* |until 0x442.7 (439) | |
|
||||
> fq -d mp4 'mp4_path(mp4_path(".moov.trak[1]"))' /fragmented.mp4
|
||||
$ fq -d mp4 'mp4_path(mp4_path(".moov.trak[1]"))' /fragmented.mp4
|
||||
".moov.trak[1]"
|
||||
|
2
format/mp4/testdata/vorbis.fqtest
vendored
2
format/mp4/testdata/vorbis.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -ac 2 -strict experimental -c:a vorbis -t 50ms vorbis.mp4
|
||||
/vorbis.mp4:
|
||||
> fq -d mp4 verbose /vorbis.mp4
|
||||
$ fq -d mp4 verbose /vorbis.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis.mp4 (mp4) 0x0-0x1188.7 (4489)
|
||||
| | | boxes: [4] 0x0-0x1188.7 (4489)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mp4/testdata/vp9.fqtest
vendored
2
format/mp4/testdata/vp9.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i testsrc -c:v vp9 -t 50ms vp9.mp4
|
||||
/vp9.mp4:
|
||||
> fq -d mp4 verbose /vp9.mp4
|
||||
$ fq -d mp4 verbose /vp9.mp4
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vp9.mp4 (mp4) 0x0-0x184e.7 (6223)
|
||||
| | | boxes: [4] 0x0-0x184e.7 (6223)
|
||||
| | | [0]: box {} 0x0-0x1b.7 (28)
|
||||
|
2
format/mpeg/testdata/adts.fqtest
vendored
2
format/mpeg/testdata/adts.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -f lavfi -i sine -ac 2 -t 40ms -f adts adts
|
||||
/adts:
|
||||
> fq -d adts verbose /adts
|
||||
$ fq -d adts verbose /adts
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /adts (adts) 0x0-0x406.7 (1031)
|
||||
| | | frames: [3] 0x0-0x406.7 (1031)
|
||||
| | | [0]: frame {} (adts_frame) 0x0-0x153.7 (340)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f wav pipe:1 | lame - - | fq - '.frame[1] | bits' > mp3-frame-mono-crc
|
||||
/mp3-frame-mono-crc:
|
||||
> fq -d mp3_frame '.header.crc | verbose' /mp3-frame-mono-crc
|
||||
$ fq -d mp3_frame '.header.crc | verbose' /mp3-frame-mono-crc
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0| 2c b9 | ,. |.header.crc: 2cb9 0x4-0x5.7 (2)
|
||||
|
2
format/mpeg/testdata/mp3-frame-mono.fqtest
vendored
2
format/mpeg/testdata/mp3-frame-mono.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -f lavfi -i sine -ac 1 -t 10ms -f mp3 file && fq file '.frame[1] | bits' > mp3-frame-mono
|
||||
/mp3-frame-mono:
|
||||
> fq -d mp3_frame verbose /mp3-frame-mono
|
||||
$ fq -d mp3_frame verbose /mp3-frame-mono
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mp3-frame-mono (mp3_frame) 0x0-0xcf.7 (208)
|
||||
| | | header: {} 0x0-0x3.7 (4)
|
||||
0x00|ff fb |.. | sync: Correct (0x7ff) 0x0-0x1.2 (1.3)
|
||||
|
2
format/mpeg/testdata/mp3-frame-stereo.fqtest
vendored
2
format/mpeg/testdata/mp3-frame-stereo.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -f lavfi -i sine -ac 2 -t 10ms -f mp3 file && fq file '.frame[1] | bits' > mp3-frame-stereo
|
||||
/mp3-frame-stereo:
|
||||
> fq -d mp3_frame verbose /mp3-frame-stereo
|
||||
$ fq -d mp3_frame verbose /mp3-frame-stereo
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /mp3-frame-stereo (mp3_frame) 0x0-0x1a0.7 (417)
|
||||
| | | header: {} 0x0-0x3.7 (4)
|
||||
0x000|ff fb |.. | sync: Correct (0x7ff) 0x0-0x1.2 (1.3)
|
||||
|
2
format/ogg/testdata/page.fqtest
vendored
2
format/ogg/testdata/page.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f ogg pipe:1 | fq - '.page[0] | bits' > page
|
||||
/page:
|
||||
> fq -d ogg_page verbose /page
|
||||
$ fq -d ogg_page verbose /page
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /page (ogg_page) 0x0-0x39.7 (58)
|
||||
0x00|4f 67 67 53 |OggS | capture_pattern: "OggS" (Correct) 0x0-0x3.7 (4)
|
||||
0x00| 00 | . | stream_structure_version: Correct (0x0) 0x4-0x4.7 (1)
|
||||
|
2
format/ogg/testdata/test.fqtest
vendored
2
format/ogg/testdata/test.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 50ms test.ogg
|
||||
/test.ogg:
|
||||
> fq -d ogg verbose /test.ogg
|
||||
$ fq -d ogg verbose /test.ogg
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.ogg (ogg) 0x0-0xe45.7 (3654)
|
||||
| | | pages: [3] 0x0-0xe45.7 (3654)
|
||||
| | | [0]: page {} (ogg_page) 0x0-0x39.7 (58)
|
||||
|
6
format/opus/testdata/opus.fqtest
vendored
6
format/opus/testdata/opus.fqtest
vendored
@ -1,7 +1,7 @@
|
||||
# ffmpeg -y -f lavfi -i sine -t 10ms -ac 2 -metadata artist=bla -c:a libopus opus.ogg
|
||||
# fq opus.ogg '.stream[0].packet[1] | bits' > opus-tags
|
||||
/opus-audio:
|
||||
> fq -d opus_packet verbose /opus-audio
|
||||
$ fq -d opus_packet verbose /opus-audio
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /opus-audio (opus_packet) 0x0-0x1b5.7 (438)
|
||||
| | | type: "audio" 0x0-NA (0)
|
||||
| | | toc: {} 0x0-0x1b5.7 (438)
|
||||
@ -19,7 +19,7 @@
|
||||
0x010|c8 c2 56 2c a6 b7 6e 98 00 9b 34 cb 23 1d 98 b7|..V,..n...4.#...|
|
||||
* |until 0x1b5.7 (end) (437) | |
|
||||
/opus-head:
|
||||
> fq -d opus_packet verbose /opus-head
|
||||
$ fq -d opus_packet verbose /opus-head
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /opus-head (opus_packet) 0x0-0x12.7 (19)
|
||||
| | | type: "head" 0x0-NA (0)
|
||||
0x00|4f 70 75 73 48 65 61 64 |OpusHead | prefix: "OpusHead" 0x0-0x7.7 (8)
|
||||
@ -30,7 +30,7 @@
|
||||
0x10|00 00 |.. | output_gain: 0 0x10-0x11.7 (2)
|
||||
0x10| 00| | .| | map_family: 0 0x12-0x12.7 (1)
|
||||
/opus-tags:
|
||||
> fq -d opus_packet verbose /opus-tags
|
||||
$ fq -d opus_packet verbose /opus-tags
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /opus-tags (opus_packet) 0x0-0x4b.7 (76)
|
||||
| | | type: "tags" 0x0-NA (0)
|
||||
0x00|4f 70 75 73 54 61 67 73 |OpusTags | prefix: "OpusTags" 0x0-0x7.7 (8)
|
||||
|
2
format/png/testdata/4x4.fqtest
vendored
2
format/png/testdata/4x4.fqtest
vendored
@ -2,7 +2,7 @@
|
||||
# pngcrush -ztxt a akeyword atext 4x4.png 4x4out.png
|
||||
# mv 4x4out.png 4x4.png
|
||||
/4x4.png:
|
||||
> fq -d png verbose /4x4.png
|
||||
$ fq -d png verbose /4x4.png
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4.png (png) 0x0-0x125.7 (294)
|
||||
0x000|89 50 4e 47 0d 0a 1a 0a |.PNG.... | signature: "\x89PNG\r\n\x1a\n" (Correct) 0x0-0x7.7 (8)
|
||||
| | | chunks: [10] 0x8-0x125.7 (286)
|
||||
|
2
format/png/testdata/4x4a.fqtest
vendored
2
format/png/testdata/4x4a.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -y -f lavfi -i testsrc=size=4x4:r=1 -t 2s 4x4a.apng
|
||||
/4x4a.apng:
|
||||
> fq -d png verbose /4x4a.apng
|
||||
$ fq -d png verbose /4x4a.apng
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4a.apng (png) 0x0-0xf3.7 (244)
|
||||
0x00|89 50 4e 47 0d 0a 1a 0a |.PNG.... | signature: "\x89PNG\r\n\x1a\n" (Correct) 0x0-0x7.7 (8)
|
||||
| | | chunks: [8] 0x8-0xf3.7 (236)
|
||||
|
2
format/tiff/testdata/4x4.fqtest
vendored
2
format/tiff/testdata/4x4.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# gm convert -size 4x4 'xc:#000' 4x4.tiff
|
||||
/4x4.tiff:
|
||||
> fq -d tiff verbose /4x4.tiff
|
||||
$ fq -d tiff verbose /4x4.tiff
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4.tiff (tiff) 0x0-0x107.7 (264)
|
||||
0x000|49 49 |II | order: "II" 0x0-0x1.7 (2)
|
||||
0x000|49 49 2a 00 |II*. | endian: little-endian (0x49492a00) 0x0-0x3.7 (4)
|
||||
|
8
format/vorbis/testdata/vorbis.fqtest
vendored
8
format/vorbis/testdata/vorbis.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f ogg pipe:1 | fq - '.steam[0].packet[0] | bits' > vorbis-identifcation
|
||||
/vorbis-identifcation:
|
||||
> fq -d vorbis_packet verbose /vorbis-identifcation
|
||||
$ fq -d vorbis_packet verbose /vorbis-identifcation
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis-identifcation (vorbis_packet) 0x0-0x1d.7 (30)
|
||||
0x00|01 |. | packet_type: Identification (1) 0x0-0x0.7 (1)
|
||||
0x00| 76 6f 72 62 69 73 | vorbis | magic: "vorbis" (Correct) 0x1-0x6.7 (6)
|
||||
@ -16,7 +16,7 @@
|
||||
0x10| 01| | .| | framing_flag: Correct (0x1) 0x1d.7-0x1d.7 (0.1)
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f ogg pipe:1 | fq - '.packet[1] | bits' > vorbis-comment
|
||||
/vorbis-comment:
|
||||
> fq -d vorbis_packet verbose /vorbis-comment
|
||||
$ fq -d vorbis_packet verbose /vorbis-comment
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis-comment (vorbis_packet) 0x0-0x3f.7 (64)
|
||||
0x00|03 |. | packet_type: Comment (3) 0x0-0x0.7 (1)
|
||||
0x00| 76 6f 72 62 69 73 | vorbis | magic: "vorbis" (Correct) 0x1-0x6.7 (6)
|
||||
@ -34,7 +34,7 @@
|
||||
0x30| 01| .| frame_bit: Correct (0x1) 0x3f.7-0x3f.7 (0.1)
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f ogg pipe:1 | fq - '.packet[2] | bits' > vorbis-setup
|
||||
/vorbis-setup:
|
||||
> fq -d vorbis_packet verbose /vorbis-setup
|
||||
$ fq -d vorbis_packet verbose /vorbis-setup
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis-setup (vorbis_packet) 0x0-0xc74.7 (3189)
|
||||
0x000|05 |. | packet_type: Setup (5) 0x0-0x0.7 (1)
|
||||
0x000| 76 6f 72 62 69 73 | vorbis | magic: "vorbis" (Correct) 0x1-0x6.7 (6)
|
||||
@ -46,7 +46,7 @@
|
||||
* |until 0xc74.7 (end) (3173) | |
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -f ogg pipe:1 | fq - '.packet[3] | bits' > vorbis-audio
|
||||
/vorbis-audio:
|
||||
> fq -d vorbis_packet verbose /vorbis-audio
|
||||
$ fq -d vorbis_packet verbose /vorbis-audio
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /vorbis-audio (vorbis_packet) 0x0-0x20.7 (33)
|
||||
0x00|54 |T | packet_type: Audio (0) 0x0-0x0.7 (1)
|
||||
0x00| dd cb ce aa 5e d8 7f 2d 01 42 00 a0 dd 71 77| ....^..-.B...qw| unknown0: ddcbceaa5ed87f2d014200a0dd71778b... 0x1-0x20.7 (32)
|
||||
|
2
format/wav/testdata/end-of-file.fqtest
vendored
2
format/wav/testdata/end-of-file.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -ac 2 -f wav pipe:1 > end-of-file.wav
|
||||
/end-of-file.wav:
|
||||
> fq -d wav verbose /end-of-file.wav
|
||||
$ fq -d wav verbose /end-of-file.wav
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /end-of-file.wav (wav) 0x0-0x731.7 (1842)
|
||||
0x000|52 49 46 46 |RIFF | id: "RIFF" 0x0-0x3.7 (4)
|
||||
0x000| ff ff ff ff | .... | size: rest of file (0xffffffff) 0x4-0x7.7 (4)
|
||||
|
2
format/wav/testdata/stereo.fqtest
vendored
2
format/wav/testdata/stereo.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms -ac 2 stereo.wav
|
||||
/stereo.wav:
|
||||
> fq -d wav verbose /stereo.wav
|
||||
$ fq -d wav verbose /stereo.wav
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /stereo.wav (wav) 0x0-0x731.7 (1842)
|
||||
0x000|52 49 46 46 |RIFF | id: "RIFF" 0x0-0x3.7 (4)
|
||||
0x000| 2a 07 00 00 | *... | size: 1834 0x4-0x7.7 (4)
|
||||
|
2
format/webp/testdata/4x4.fqtest
vendored
2
format/webp/testdata/4x4.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# convert -size 4x4 "xc:#000" 4x4.webp
|
||||
/4x4.webp:
|
||||
> fq -d webp verbose /4x4.webp
|
||||
$ fq -d webp verbose /4x4.webp
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /4x4.webp (webp) 0x0-0x2b.7 (44)
|
||||
0x00|52 49 46 46 |RIFF | riff_id: "RIFF" (Correct) 0x0-0x3.7 (4)
|
||||
0x00| 24 00 00 00 | $... | riff_length: 36 0x4-0x7.7 (4)
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@ -78,20 +77,35 @@ func (tcr *testCaseRun) FS() fs.FS { return tcr.testCase }
|
||||
|
||||
func (tcr *testCaseRun) Readline(prompt string, complete func(line string, pos int) (newLine []string, shared int)) (string, error) {
|
||||
tcr.actualStdoutBuf.WriteString(prompt)
|
||||
if tcr.readlinesPos > len(tcr.readlines) {
|
||||
if tcr.readlinesPos >= len(tcr.readlines) {
|
||||
return "", io.EOF
|
||||
}
|
||||
|
||||
tcrLine := tcr.readlines[tcr.readlinesPos]
|
||||
lineRaw := tcr.readlines[tcr.readlinesPos].input
|
||||
line := Unescape(lineRaw)
|
||||
tcr.readlinesPos++
|
||||
|
||||
tcr.actualStdoutBuf.WriteString(tcrLine.input + "\n")
|
||||
if strings.HasSuffix(line, "\t") {
|
||||
tcr.actualStdoutBuf.WriteString(lineRaw + "\n")
|
||||
|
||||
if tcrLine.input == "^D" {
|
||||
l := len(line) - 1
|
||||
newLine, shared := complete(line[0:l], l)
|
||||
// TODO: shared
|
||||
_ = shared
|
||||
for _, nl := range newLine {
|
||||
tcr.actualStdoutBuf.WriteString(nl + "\n")
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
tcr.actualStdoutBuf.WriteString(lineRaw + "\n")
|
||||
|
||||
if line == "^D" {
|
||||
return "", io.EOF
|
||||
}
|
||||
|
||||
return tcrLine.input, nil
|
||||
return line, nil
|
||||
}
|
||||
func (tcr *testCaseRun) History() ([]string, error) { return nil, nil }
|
||||
|
||||
@ -103,9 +117,9 @@ func (tcr *testCaseRun) ToExpectedStdout() string {
|
||||
} else {
|
||||
for _, rl := range tcr.readlines {
|
||||
fmt.Fprintf(sb, "%s%s\n", rl.expectedPrompt, rl.input)
|
||||
// if rl.expectedStdout != "" {
|
||||
// fmt.Fprint(sb, rl.expectedStdout)
|
||||
// }
|
||||
if rl.expectedStdout != "" {
|
||||
fmt.Fprint(sb, rl.expectedStdout)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +168,7 @@ func (tc *testCase) ToActual() string {
|
||||
case *testCaseComment:
|
||||
fmt.Fprintf(sb, "#%s\n", p.comment)
|
||||
case *testCaseRun:
|
||||
fmt.Fprintf(sb, ">%s\n", p.args)
|
||||
fmt.Fprintf(sb, "$%s\n", p.args)
|
||||
fmt.Fprint(sb, p.actualStdoutBuf.String())
|
||||
if p.actualExitCode != 0 {
|
||||
fmt.Fprintf(sb, "exitcode: %d\n", p.actualExitCode)
|
||||
@ -204,17 +218,24 @@ type Section struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
var unescapeRe = regexp.MustCompile(`\\(?:b[01]+|x[0-f]+)`)
|
||||
var unescapeRe = regexp.MustCompile(`\\(?:t|b|n|r|0(?:b[01]{8}|x[0-f]{2}))`)
|
||||
|
||||
func Unescape(s string) string {
|
||||
return unescapeRe.ReplaceAllStringFunc(s, func(r string) string {
|
||||
log.Printf("r: %s\n", r)
|
||||
switch {
|
||||
case r[1] == 'b':
|
||||
b, _ := bitio.BytesFromBitString(r[2:])
|
||||
case r == `\n`:
|
||||
return "\n"
|
||||
case r == `\r`:
|
||||
return "\r"
|
||||
case r == `\t`:
|
||||
return "\t"
|
||||
case r == `\b`:
|
||||
return "\b"
|
||||
case strings.HasPrefix(r, `\0b`):
|
||||
b, _ := bitio.BytesFromBitString(r[3:])
|
||||
return string(b)
|
||||
case r[1] == 'x':
|
||||
b, _ := hex.DecodeString(r[2:])
|
||||
case strings.HasPrefix(r, `\0x`):
|
||||
b, _ := hex.DecodeString(r[3:])
|
||||
return string(b)
|
||||
default:
|
||||
return r
|
||||
@ -269,7 +290,7 @@ func parseTestCases(s string) *testCase {
|
||||
replDepth := 0
|
||||
|
||||
// TODO: better section splitter, too much heuristics now
|
||||
for _, section := range SectionParser(regexp.MustCompile(`^stdin:$|^stderr:$|^exitcode:.*$|^#.*$|^/.*:|^> .*|^[a-z].+> .*`), s) {
|
||||
for _, section := range SectionParser(regexp.MustCompile(`^\$ .*$|^stdin:$|^stderr:$|^exitcode:.*$|^#.*$|^/.*:|^(?:>* )?[a-z\d]+> .*$`), s) {
|
||||
n, v := section.Name, section.Value
|
||||
|
||||
switch {
|
||||
@ -279,7 +300,7 @@ func parseTestCases(s string) *testCase {
|
||||
case strings.HasPrefix(n, "/"):
|
||||
name := n[0 : len(n)-1]
|
||||
te.parts = append(te.parts, &testCaseFile{lineNr: section.LineNr, name: name, data: []byte(v)})
|
||||
case strings.HasPrefix(n, ">"):
|
||||
case strings.HasPrefix(n, "$"):
|
||||
replDepth++
|
||||
|
||||
if currentTestRun != nil {
|
||||
@ -289,7 +310,7 @@ func parseTestCases(s string) *testCase {
|
||||
currentTestRun = &testCaseRun{
|
||||
lineNr: section.LineNr,
|
||||
testCase: te,
|
||||
args: strings.TrimPrefix(n, ">"),
|
||||
args: strings.TrimPrefix(n, "$"),
|
||||
expectedStdout: v,
|
||||
actualStdoutBuf: &bytes.Buffer{},
|
||||
actualStderrBuf: &bytes.Buffer{},
|
||||
@ -301,9 +322,10 @@ func parseTestCases(s string) *testCase {
|
||||
case strings.HasPrefix(n, "stderr"):
|
||||
currentTestRun.expectedStderr = v
|
||||
case strings.Contains(n, promptEnd): // TODO: better
|
||||
parts := strings.SplitN(n, promptEnd, 2)
|
||||
prompt := parts[0] + promptEnd
|
||||
input := parts[1]
|
||||
i := strings.LastIndex(n, promptEnd)
|
||||
|
||||
prompt := n[0:i] + promptEnd
|
||||
input := n[i+2:]
|
||||
|
||||
currentTestRun.readlines = append(currentTestRun.readlines, testCaseReadline{
|
||||
input: input,
|
||||
|
@ -33,7 +33,7 @@ a:
|
||||
|
||||
func TestUnescape(t *testing.T) {
|
||||
|
||||
s := fqtest.Unescape(`asd \b123213 asd \xffcb sdfd `)
|
||||
log.Printf("s: %#+v\n", s)
|
||||
s := fqtest.Unescape(`asd\n\r\t \0b11110000 asd \0xffcb sdfd `)
|
||||
log.Printf("s: %v\n", []byte(s))
|
||||
|
||||
}
|
||||
|
28
pkg/interp/testdata/args.fqtest
vendored
28
pkg/interp/testdata/args.fqtest
vendored
@ -1,11 +1,11 @@
|
||||
/test.mp3:
|
||||
> fq
|
||||
$ fq
|
||||
fq - jq for binary
|
||||
Tool, language and decoders for querying and exploring binary data.
|
||||
For more information see https://github.com/wader/fq
|
||||
|
||||
Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
|
||||
> fq -h
|
||||
$ fq -h
|
||||
fq - jq for binary
|
||||
Tool, language and decoders for querying and exploring binary data.
|
||||
For more information see https://github.com/wader/fq
|
||||
@ -37,31 +37,31 @@ Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
|
||||
--repl,-i Interactive REPL
|
||||
--slurp,-s Read (slurp) all inputs into an array
|
||||
--version,-v Show version (dev)
|
||||
> fq -i
|
||||
$ fq -i
|
||||
null> ^D
|
||||
> fq -i . /test.mp3
|
||||
$ fq -i . /test.mp3
|
||||
mp3> ^D
|
||||
> fq -n
|
||||
$ fq -n
|
||||
fq - jq for binary
|
||||
Tool, language and decoders for querying and exploring binary data.
|
||||
For more information see https://github.com/wader/fq
|
||||
|
||||
Usage: fq [OPTIONS] [--] [EXPR] [FILE...]
|
||||
> fq -ni
|
||||
$ fq -ni
|
||||
null> ^D
|
||||
> fq -n 123
|
||||
$ fq -n 123
|
||||
123
|
||||
> fq -ni 123
|
||||
$ fq -ni 123
|
||||
number> ^D
|
||||
> fq -n "[1,2,3]"
|
||||
$ fq -n "[1,2,3]"
|
||||
[
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]
|
||||
> fq -nc "[1,2,3]"
|
||||
$ fq -nc "[1,2,3]"
|
||||
[1,2,3]
|
||||
> fq --formats
|
||||
$ fq --formats
|
||||
Name: Description:
|
||||
aac_frame Advanced Audio Coding frame
|
||||
adts Audio Data Transport Stream
|
||||
@ -123,15 +123,15 @@ vpx_ccr VPX Codec Configuration Record
|
||||
wav WAV file
|
||||
webp WebP image
|
||||
xing Xing header
|
||||
> fq -X
|
||||
$ fq -X
|
||||
exitcode: 2
|
||||
stderr:
|
||||
error: -X: no such argument
|
||||
> fq --X
|
||||
$ fq --X
|
||||
exitcode: 2
|
||||
stderr:
|
||||
error: --X: no such argument
|
||||
> fq -.
|
||||
$ fq -.
|
||||
exitcode: 2
|
||||
stderr:
|
||||
error: -.: no such argument
|
||||
|
20
pkg/interp/testdata/basic.fqtest
vendored
20
pkg/interp/testdata/basic.fqtest
vendored
@ -1,36 +1,36 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms test.mp3
|
||||
/test.mp3:
|
||||
> fq -d mp3 '.headers[0].magic == "ID3"' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic == "ID3"' /test.mp3
|
||||
true
|
||||
> fq -d mp3 '.headers[0].version == 4' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version == 4' /test.mp3
|
||||
true
|
||||
> fq -d mp3 '.frames[0].header.protection == true' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].header.protection == true' /test.mp3
|
||||
true
|
||||
> fq -d mp3 '.headers[0].flags + {}' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags + {}' /test.mp3
|
||||
{
|
||||
"experimental_indicator": false,
|
||||
"extended_header": false,
|
||||
"unsynchronisation": false,
|
||||
"unused": 0
|
||||
}
|
||||
> fq -d mp3 '._unknown' /test.mp3
|
||||
$ fq -d mp3 '._unknown' /test.mp3
|
||||
false
|
||||
> fq -d mp3 '._format' /test.mp3
|
||||
$ fq -d mp3 '._format' /test.mp3
|
||||
"mp3"
|
||||
> fq -d mp3 '.headers[0].magic._format' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._format' /test.mp3
|
||||
null
|
||||
> fq -d raw '._bytes | string'
|
||||
$ fq -d raw '._bytes | string'
|
||||
"abc\n"
|
||||
stdin:
|
||||
abc
|
||||
> fq -n "{a: 123, b: []} | debug"
|
||||
$ fq -n "{a: 123, b: []} | debug"
|
||||
{
|
||||
"a": 123,
|
||||
"b": []
|
||||
}
|
||||
stderr:
|
||||
["DEBUG",{"a":123,"b":[]}]
|
||||
> fq -n options
|
||||
$ fq -n options
|
||||
{
|
||||
"addrbase": 16,
|
||||
"bitsformat": "snippet",
|
||||
|
26
pkg/interp/testdata/buffer.fqtest
vendored
26
pkg/interp/testdata/buffer.fqtest
vendored
@ -1,42 +1,42 @@
|
||||
/test.mp3:
|
||||
> fq -d mp3 '.headers[0].magic._bits[8:16] | hd' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits[8:16] | hd' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|44 |D |
|
||||
> fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | hd' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | hd' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|44 49 |DI |
|
||||
> fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | bits | hd' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | bits | hd' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|44 49 |DI |
|
||||
> fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | bytes | hd' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | bytes | hd' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|44 49 |DI |
|
||||
> fq -n '"12" | bytes | hd'
|
||||
$ fq -n '"12" | bytes | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|31 32 |12 |
|
||||
> fq -n '"12" | bits | hd'
|
||||
$ fq -n '"12" | bits | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|31 32 |12 |
|
||||
> fq -n '["12", "3"] | bytes | hd'
|
||||
$ fq -n '["12", "3"] | bytes | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|31 32 33 |123 |
|
||||
> fq -n '["12", "3"] | bits | hd'
|
||||
$ fq -n '["12", "3"] | bits | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|31 32 33 |123 |
|
||||
> fq -n '[("11" | hex), ("22" | hex)] | bits | hd'
|
||||
$ fq -n '[("11" | hex), ("22" | hex)] | bits | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|11 22 |." |
|
||||
# TODO: bug, hexdump uses io.Copy which is byte oritneted
|
||||
> fq -n '[("12" | hex | .bits[4:]), ("34" | hex | .bits[0:4])] | bits | hd'
|
||||
$ fq -n '[("12" | hex | .bits[4:]), ("34" | hex | .bits[0:4])] | bits | hd'
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|23 |# |
|
||||
> fq -d mp3 '.frames[]._bits[0:12] | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.frames[]._bits[0:12] | tonumber' /test.mp3
|
||||
4095
|
||||
4095
|
||||
4095
|
||||
> fq -d mp3 '.headers[0].magic._bits[0:24] | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits[0:24] | tostring' /test.mp3
|
||||
"ID3"
|
||||
> fq -d mp3 '.frames[0].padding | ("", "md5", "base64", "snippet") as $f | tovalue({bitsformat: $f})' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].padding | ("", "md5", "base64", "snippet") as $f | tovalue({bitsformat: $f})' /test.mp3
|
||||
"<5>AAAAAAA="
|
||||
"ca9c491ac66b2c62500882e93f3719a8"
|
||||
"AAAAAAA="
|
||||
|
36
pkg/interp/testdata/completion.fqtest
vendored
Normal file
36
pkg/interp/testdata/completion.fqtest
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/test.mp3:
|
||||
$ fq -i
|
||||
null> he\t
|
||||
help
|
||||
hevc_au
|
||||
hevc_dcr
|
||||
hevc_nalu
|
||||
hex
|
||||
hexdump
|
||||
null> {aa: 123, ab: "a"} | .a\t
|
||||
aa
|
||||
ab
|
||||
null> {aa: 123, ab: "a"} | repl
|
||||
> object> .a\t
|
||||
aa
|
||||
ab
|
||||
> object> ^D
|
||||
null> ^D
|
||||
$ fq -i . /test.mp3
|
||||
mp3> .f\t
|
||||
footers
|
||||
frames
|
||||
mp3> ._\t
|
||||
_bits
|
||||
_bytes
|
||||
_description
|
||||
_error
|
||||
_format
|
||||
_len
|
||||
_name
|
||||
_path
|
||||
_start
|
||||
_stop
|
||||
_symbol
|
||||
_unknown
|
||||
mp3> ^D
|
2
pkg/interp/testdata/configinit.fqtest
vendored
2
pkg/interp/testdata/configinit.fqtest
vendored
@ -1,4 +1,4 @@
|
||||
/config/init.jq:
|
||||
def a: "a";
|
||||
> fq -n a
|
||||
$ fq -n a
|
||||
"a"
|
||||
|
12
pkg/interp/testdata/display.fqtest
vendored
12
pkg/interp/testdata/display.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms test.mp3
|
||||
/test.mp3:
|
||||
> fq -d mp3 'display({depth: 1})' /test.mp3
|
||||
$ fq -d mp3 'display({depth: 1})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.mp3 (mp3)
|
||||
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers: [1]
|
||||
* |until 0x2c.7 (45) | |
|
||||
@ -8,7 +8,7 @@
|
||||
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
* |until 0x283.7 (end) (599) | |
|
||||
| | | footers: [0]
|
||||
> fq -d mp3 'display({depth: 2})' /test.mp3
|
||||
$ fq -d mp3 'display({depth: 2})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.mp3 (mp3)
|
||||
| | | headers: [1]
|
||||
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| [0]: {} (id3v2)
|
||||
@ -24,7 +24,7 @@
|
||||
0x1c0|00 00 00 34 80 00 00 04 11 4b 36 4a 08 83 58 c9|...4.....K6J..X.|
|
||||
* |until 0x283.7 (end) (209) | |
|
||||
| | | footers: [0]
|
||||
> fq -d mp3 'display({depth: 1, displaybytes: 8})' /test.mp3
|
||||
$ fq -d mp3 'display({depth: 1, displaybytes: 8})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.: {} /test.mp3 (mp3)
|
||||
0x000|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| headers: [1]
|
||||
* |until 0x2c.7 (45) | |
|
||||
@ -32,7 +32,7 @@
|
||||
0x030|c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
* |until 0x283.7 (end) (599) | |
|
||||
| | | footers: [0]
|
||||
> fq -d mp3 'display({depth: 1, linebytes: 8})' /test.mp3
|
||||
$ fq -d mp3 'display({depth: 1, linebytes: 8})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07| |.: {} /test.mp3 (mp3)
|
||||
0x000|49 44 33 04 00 00 00 00|ID3.....| headers: [1]
|
||||
0x008|00 23 54 53 53 45 00 00|.#TSSE..|
|
||||
@ -42,7 +42,7 @@
|
||||
0x038|00 00 00 00 00 00 00 00|........|
|
||||
* |until 0x283.7 (end) (599)| |
|
||||
| | | footers: [0]
|
||||
> fq -d mp3 '.frames[0] | verbose({depth: 1, addrbase: 10})' /test.mp3
|
||||
$ fq -d mp3 '.frames[0] | verbose({depth: 1, addrbase: 10})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15| |.frames[0]: frame {} (mp3_frame) 45-226.7 (182)
|
||||
032| ff fb 40| ..@| header: {} 45-48.7 (4)
|
||||
048|c0 |. |
|
||||
@ -54,7 +54,7 @@
|
||||
208| 00 00| ..| padding: 0000000000 222-226.7 (5)
|
||||
224|00 00 00 |... |
|
||||
| | | crc_calculated: 827a 227-NA (0)
|
||||
> fq -d mp3 '.frames[0] | verbose({depth: 1, sizebase: 16})' /test.mp3
|
||||
$ fq -d mp3 '.frames[0] | verbose({depth: 1, sizebase: 16})' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.frames[0]: frame {} (mp3_frame) 0x2d-0xe2.7 (0xb6)
|
||||
0x20| ff fb 40| ..@| header: {} 0x2d-0x30.7 (0x4)
|
||||
0x30|c0 |. |
|
||||
|
12
pkg/interp/testdata/exitcode.fqtest
vendored
12
pkg/interp/testdata/exitcode.fqtest
vendored
@ -1,22 +1,22 @@
|
||||
> fq -n '1+"a"'
|
||||
$ fq -n '1+"a"'
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: number (1) and string ("a")
|
||||
> fq -n '"abc" | halt_error(123)'
|
||||
$ fq -n '"abc" | halt_error(123)'
|
||||
exitcode: 123
|
||||
stderr:
|
||||
error: abc
|
||||
> fq -n 'null | halt_error(123)'
|
||||
$ fq -n 'null | halt_error(123)'
|
||||
exitcode: 123
|
||||
> fq -n invalid
|
||||
$ fq -n invalid
|
||||
exitcode: 3
|
||||
stderr:
|
||||
error: src:1:0: function not defined: invalid/0
|
||||
> fq -n "("
|
||||
$ fq -n "("
|
||||
exitcode: 3
|
||||
stderr:
|
||||
error: src:1:2: unexpected token <EOF>
|
||||
> fq . non-existing
|
||||
$ fq . non-existing
|
||||
exitcode: 2
|
||||
stderr:
|
||||
error: non-existing: file not found
|
||||
|
22
pkg/interp/testdata/gojq.fqtest
vendored
22
pkg/interp/testdata/gojq.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
# TODO: various gojq fq fork regression tests, should probably be move to fork code instead
|
||||
/test.mp3:
|
||||
> fq -n '{a:1, b: 2} | tostream'
|
||||
$ fq -n '{a:1, b: 2} | tostream'
|
||||
[
|
||||
[
|
||||
"a"
|
||||
@ -18,22 +18,22 @@
|
||||
"b"
|
||||
]
|
||||
]
|
||||
> fq -d mp3 '{(.headers[0].magic): 123}' /test.mp3
|
||||
$ fq -d mp3 '{(.headers[0].magic): 123}' /test.mp3
|
||||
{
|
||||
"ID3": 123
|
||||
}
|
||||
> fq -d mp3 '{(.headers[0].magic): 123}' /test.mp3
|
||||
$ fq -d mp3 '{(.headers[0].magic): 123}' /test.mp3
|
||||
{
|
||||
"ID3": 123
|
||||
}
|
||||
/test.mp3:
|
||||
> fq -d mp3 '.frames | group_by(.side_info | {b: .main_data_end}) | map(length)' /test.mp3
|
||||
$ fq -d mp3 '.frames | group_by(.side_info | {b: .main_data_end}) | map(length)' /test.mp3
|
||||
[
|
||||
2,
|
||||
1
|
||||
]
|
||||
/test.mp3:
|
||||
> fq -d mp3 '.frames | map(.header) | group_by(.bitrate)' /test.mp3
|
||||
$ fq -d mp3 '.frames | map(.header) | group_by(.bitrate)' /test.mp3
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -88,7 +88,7 @@
|
||||
}
|
||||
]
|
||||
]
|
||||
> fq -d mp3 '.frames | map(.header) | sort_by(.bitrate)' /test.mp3
|
||||
$ fq -d mp3 '.frames | map(.header) | sort_by(.bitrate)' /test.mp3
|
||||
[
|
||||
{
|
||||
"bitrate": 56000,
|
||||
@ -139,7 +139,7 @@
|
||||
"sync": 2047
|
||||
}
|
||||
]
|
||||
> fq -d mp3 '.frames | map(.header) | sort_by(.bitrate)[0]' /test.mp3
|
||||
$ fq -d mp3 '.frames | map(.header) | sort_by(.bitrate)[0]' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.frames[0].header: {}
|
||||
0x20| ff fb | .. | sync: Correct (0x7ff)
|
||||
0x20| fb | . | mpeg_version: MPEG Version 1 (1)
|
||||
@ -155,7 +155,7 @@
|
||||
0x30|c0 |. | copyright: 0
|
||||
0x30|c0 |. | original: 0
|
||||
0x30|c0 |. | emphasis: None (0b0)
|
||||
> fq -d mp3 '.frames | map(.header) | min_by(.bitrate)' /test.mp3
|
||||
$ fq -d mp3 '.frames | map(.header) | min_by(.bitrate)' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.frames[0].header: {}
|
||||
0x20| ff fb | .. | sync: Correct (0x7ff)
|
||||
0x20| fb | . | mpeg_version: MPEG Version 1 (1)
|
||||
@ -171,7 +171,7 @@
|
||||
0x30|c0 |. | copyright: 0
|
||||
0x30|c0 |. | original: 0
|
||||
0x30|c0 |. | emphasis: None (0b0)
|
||||
> fq -d mp3 '.frames | map(.header) | max_by(.bitrate)' /test.mp3
|
||||
$ fq -d mp3 '.frames | map(.header) | max_by(.bitrate)' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.frames[2].header: {}
|
||||
0x1b0| ff fb | .. | sync: Correct (0x7ff)
|
||||
0x1b0| fb | . | mpeg_version: MPEG Version 1 (1)
|
||||
@ -187,7 +187,7 @@
|
||||
0x1b0| c4 | . | copyright: 0
|
||||
0x1b0| c4 | . | original: 1
|
||||
0x1b0| c4 | . | emphasis: None (0b0)
|
||||
> fq -d mp3 '.frames[0] | . + .header | keys, .bitrate' /test.mp3
|
||||
$ fq -d mp3 '.frames[0] | . + .header | keys, .bitrate' /test.mp3
|
||||
[
|
||||
"bitrate",
|
||||
"channel_mode",
|
||||
@ -210,7 +210,7 @@
|
||||
]
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x20| 40| @|.frames[0].header.bitrate: 56000
|
||||
> fq -d mp3 '[.frames[0] | ., .header] | add | keys, .bitrate' /test.mp3
|
||||
$ fq -d mp3 '[.frames[0] | ., .header] | add | keys, .bitrate' /test.mp3
|
||||
[
|
||||
"bitrate",
|
||||
"channel_mode",
|
||||
|
6
pkg/interp/testdata/hexdump.fqtest
vendored
6
pkg/interp/testdata/hexdump.fqtest
vendored
@ -1,12 +1,12 @@
|
||||
# ffmpeg -f lavfi -i sine -t 10ms test.mp3
|
||||
/test.mp3:
|
||||
> fq -d mp3 '._bits[0:(16+8)*8] | hexdump' /test.mp3
|
||||
$ fq -d mp3 '._bits[0:(16+8)*8] | hexdump' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|
|
||||
0x10|00 0f 00 00 03 4c 61 76 |.....Lav |
|
||||
> fq -d mp3 '.frames[1].header.layer | hexdump' /test.mp3
|
||||
$ fq -d mp3 '.frames[1].header.layer | hexdump' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0xe0| fa | . |
|
||||
> fq -d mp3 '.frames[1].header.layer._bytes | hexdump' /test.mp3
|
||||
$ fq -d mp3 '.frames[1].header.layer._bytes | hexdump' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|40 |@ |
|
||||
|
30
pkg/interp/testdata/inputs.fqtest
vendored
30
pkg/interp/testdata/inputs.fqtest
vendored
@ -4,76 +4,76 @@ a
|
||||
b
|
||||
/c:
|
||||
c
|
||||
> fq -d raw ._description /a /b /c
|
||||
$ fq -d raw ._description /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
> fq -d raw (.,inputs)._description /a /b /c
|
||||
$ fq -d raw (.,inputs)._description /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
> fq -d raw (.,input,input,input)._description /a /b /c
|
||||
$ fq -d raw (.,input,input,input)._description /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: break
|
||||
> fq -d raw -n (.,inputs)._description /a /b /c
|
||||
$ fq -d raw -n (.,inputs)._description /a /b /c
|
||||
null
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
> fq -d raw -n inputs._description /a /b /c
|
||||
$ fq -d raw -n inputs._description /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
> fq -d raw -n '[inputs._description]' /a /b /c
|
||||
$ fq -d raw -n '[inputs._description]' /a /b /c
|
||||
[
|
||||
"/a",
|
||||
"/b",
|
||||
"/c"
|
||||
]
|
||||
> fq -d raw -n (input,input,input,input)._description /a /b /c
|
||||
$ fq -d raw -n (input,input,input,input)._description /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: break
|
||||
> fq -d raw input_filename /a /b /c
|
||||
$ fq -d raw input_filename /a /b /c
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
> fq -d raw input_filename /a /non-existing /c
|
||||
$ fq -d raw input_filename /a /non-existing /c
|
||||
"/a"
|
||||
"/c"
|
||||
exitcode: 2
|
||||
stderr:
|
||||
error: /non-existing: file not found
|
||||
> fq -d raw '(' /a /b /c
|
||||
$ fq -d raw '(' /a /b /c
|
||||
exitcode: 3
|
||||
stderr:
|
||||
error: src:1:2: unexpected token <EOF>
|
||||
> fq -d raw bla /a /b /c
|
||||
$ fq -d raw bla /a /b /c
|
||||
exitcode: 3
|
||||
stderr:
|
||||
error: src:1:0: function not defined: bla/0
|
||||
> fq -d raw '1+"a"' /a /b /c
|
||||
$ fq -d raw '1+"a"' /a /b /c
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: number (1) and string ("a")
|
||||
error: cannot add: number (1) and string ("a")
|
||||
error: cannot add: number (1) and string ("a")
|
||||
> fq -s -d raw [.[]._description] /a /b /c
|
||||
$ fq -s -d raw [.[]._description] /a /b /c
|
||||
[
|
||||
"/a",
|
||||
"/b",
|
||||
"/c"
|
||||
]
|
||||
> fq -n -s -d raw . /a /b /c
|
||||
$ fq -n -s -d raw . /a /b /c
|
||||
null
|
||||
> fq . /a
|
||||
$ fq . /a
|
||||
exitcode: 4
|
||||
stderr:
|
||||
error: /a: failed to decode (probe), try -d FORMAT to force
|
||||
|
2
pkg/interp/testdata/noconfiginit.fqtest
vendored
2
pkg/interp/testdata/noconfiginit.fqtest
vendored
@ -1,2 +1,2 @@
|
||||
> fq -n 1
|
||||
$ fq -n 1
|
||||
1
|
||||
|
18
pkg/interp/testdata/output.fqtest
vendored
18
pkg/interp/testdata/output.fqtest
vendored
@ -1,15 +1,15 @@
|
||||
> fq -n '"a b c"'
|
||||
$ fq -n '"a b c"'
|
||||
"a b c"
|
||||
> fq -rn '"a b c"'
|
||||
$ fq -rn '"a b c"'
|
||||
a b c
|
||||
> fq -n 1,2,3
|
||||
$ fq -n 1,2,3
|
||||
1
|
||||
2
|
||||
3
|
||||
# TODO: somehow support encoded expected output with no newline?
|
||||
#> fq -nj 1,2,3
|
||||
#> fq -n0 1,2,3
|
||||
#> fq -nj0 1,2,3
|
||||
#> fq -nj "a","b","c"
|
||||
#> fq -n0 "a","b","c"
|
||||
#> fq -nj0 "a","b","c"
|
||||
#$ fq -nj 1,2,3
|
||||
#$ fq -n0 1,2,3
|
||||
#$ fq -nj0 1,2,3
|
||||
#$ fq -nj "a","b","c"
|
||||
#$ fq -n0 "a","b","c"
|
||||
#$ fq -nj0 "a","b","c"
|
||||
|
4
pkg/interp/testdata/scriptfile.fqtest
vendored
4
pkg/interp/testdata/scriptfile.fqtest
vendored
@ -3,9 +3,9 @@
|
||||
/test2.jq:
|
||||
.headers[0].magic | tovalue
|
||||
/test.mp3:
|
||||
> fq -n -f /test.jq
|
||||
$ fq -n -f /test.jq
|
||||
123
|
||||
/test.jq:
|
||||
123
|
||||
> fq -f /test2.jq /test.mp3
|
||||
$ fq -f /test2.jq /test.mp3
|
||||
"ID3"
|
||||
|
42
pkg/interp/testdata/value.fqtest
vendored
42
pkg/interp/testdata/value.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
/test.mp3:
|
||||
# ffmpeg -f lavfi -i sine -t 10ms test.mp3
|
||||
> fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.frames[0].xing: {} (xing)
|
||||
0x40| 49 6e 66 6f | Info | header: "Info"
|
||||
0x40| 00 00 00 0f | .... | present_flags: {}
|
||||
@ -122,7 +122,7 @@
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x40| 0f | . |.frames[0].xing.present_flags.toc: true
|
||||
null
|
||||
> fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | tovalue' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | tovalue' /test.mp3
|
||||
{
|
||||
"bytes": 599,
|
||||
"frames": 2,
|
||||
@ -364,7 +364,7 @@ null
|
||||
"Info"
|
||||
true
|
||||
null
|
||||
> fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | tovalue' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | tovalue' /test.mp3
|
||||
{
|
||||
"bytes": 599,
|
||||
"frames": 2,
|
||||
@ -606,64 +606,64 @@ null
|
||||
"Info"
|
||||
true
|
||||
null
|
||||
> fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | type' /test.mp3
|
||||
$ fq -d mp3 '.frames[0].xing | ., .frames, .toc, .header, .present_flags.toc, .missing | type' /test.mp3
|
||||
"object"
|
||||
"number"
|
||||
"array"
|
||||
"string"
|
||||
"boolean"
|
||||
"null"
|
||||
> fq -d mp3 '.headers | length, type' /test.mp3
|
||||
$ fq -d mp3 '.headers | length, type' /test.mp3
|
||||
1
|
||||
"array"
|
||||
> fq -d mp3 '.headers | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers | tostring' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tostring cannot be applied to: array
|
||||
> fq -d mp3 '.headers | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: array
|
||||
> fq -d mp3 '.headers[0] | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0] | tostring' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tostring cannot be applied to: object
|
||||
> fq -d mp3 '.headers[0] | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0] | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: object
|
||||
> fq -d mp3 '.headers[0].version | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | tonumber' /test.mp3
|
||||
4
|
||||
> fq -d mp3 '.headers[0].version | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | tostring' /test.mp3
|
||||
"4"
|
||||
> fq -d mp3 '.headers[0].magic | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: invalid number: "ID3"
|
||||
> fq -d mp3 '.headers[0].magic | tovalue, length, tostring, type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | tovalue, length, tostring, type' /test.mp3
|
||||
"ID3"
|
||||
3
|
||||
"ID3"
|
||||
"string"
|
||||
> fq -d mp3 '.headers[0].magic[4]' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[4]' /test.mp3
|
||||
""
|
||||
> fq -d mp3 '.headers[0].magic[4:10]' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[4:10]' /test.mp3
|
||||
""
|
||||
> fq -d mp3 '.headers[10]' /test.mp3
|
||||
$ fq -d mp3 '.headers[10]' /test.mp3
|
||||
null
|
||||
> fq -d mp3 '.headers[10:20]' /test.mp3
|
||||
$ fq -d mp3 '.headers[10:20]' /test.mp3
|
||||
[]
|
||||
> fq -d mp3 '.headers[0].padding | tovalue, length, tostring, type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | tovalue, length, tostring, type' /test.mp3
|
||||
null
|
||||
0
|
||||
"null"
|
||||
"null"
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | tovalue, tostring, type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | tovalue, tostring, type' /test.mp3
|
||||
false
|
||||
"false"
|
||||
"boolean"
|
||||
# regresison null value (padding)
|
||||
> fq -d mp3 '.headers[0] | tovalue' /test.mp3
|
||||
$ fq -d mp3 '.headers[0] | tovalue' /test.mp3
|
||||
{
|
||||
"flags": {
|
||||
"experimental_indicator": false,
|
||||
@ -699,7 +699,7 @@ false
|
||||
"version": 4
|
||||
}
|
||||
# test each in decoded order
|
||||
> fq -d mp3 '.headers[0][]' /test.mp3
|
||||
$ fq -d mp3 '.headers[0][]' /test.mp3
|
||||
|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)
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
|
56
pkg/interp/testdata/value_array.fqtest
vendored
56
pkg/interp/testdata/value_array.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers | ., tovalue, type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.headers: [1]
|
||||
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| [0]: {} (id3v2)
|
||||
* |until 0x2c.7 (45) | |
|
||||
@ -43,7 +43,7 @@
|
||||
"array"
|
||||
1
|
||||
# index
|
||||
> fq -d mp3 '.headers[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0] | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.headers[0]: {} (id3v2)
|
||||
0x00|49 44 33 |ID3 | magic: "ID3" (Correct)
|
||||
0x00| 04 | . | version: 4
|
||||
@ -56,24 +56,24 @@
|
||||
0x20| 00 00 00 00 00 00 00 00 00 00 | .......... | padding: Correct (none) (zero padding)
|
||||
"object"
|
||||
7
|
||||
> fq -d mp3 '.headers[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[-1000] | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[1000] | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
# slice
|
||||
> fq -d mp3 '.headers[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[1:3] | ., type, length?' /test.mp3
|
||||
[]
|
||||
"array"
|
||||
0
|
||||
> fq -d mp3 '.headers[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0:-1] | ., type, length?' /test.mp3
|
||||
[]
|
||||
"array"
|
||||
0
|
||||
> fq -d mp3 '.headers[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[-1000:2000] | ., type, length?' /test.mp3
|
||||
[
|
||||
{
|
||||
"flags": {
|
||||
@ -113,95 +113,95 @@ null
|
||||
"array"
|
||||
1
|
||||
# key
|
||||
> fq -d mp3 '.headers["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers["test"] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an object with key "test" but got: array
|
||||
# each
|
||||
> fq -d mp3 '[.headers[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[]] | type, length?' /test.mp3
|
||||
"array"
|
||||
1
|
||||
# keys
|
||||
> fq -d mp3 '.headers | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers | keys' /test.mp3
|
||||
[
|
||||
0
|
||||
]
|
||||
# has
|
||||
> fq -d mp3 '.headers | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers | has("a")' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot check whether array has a key: a
|
||||
> fq -d mp3 '.headers | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers | has(0)' /test.mp3
|
||||
true
|
||||
# type
|
||||
> fq -d mp3 '.headers | type' /test.mp3
|
||||
$ fq -d mp3 '.headers | type' /test.mp3
|
||||
"array"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: array
|
||||
# tostring
|
||||
> fq -d mp3 '.headers | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers | tostring' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tostring cannot be applied to: array
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers + ""' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: array ([{"flags":{"experimental_ ...]) and string ("")
|
||||
> fq -d mp3 '.headers + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers + 1' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: array ([{"flags":{"experimental_ ...]) and number (1)
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._start | ., type, length?' /test.mp3
|
||||
0
|
||||
"number"
|
||||
0
|
||||
> fq -d mp3 '.headers._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._stop | ., type, length?' /test.mp3
|
||||
360
|
||||
"number"
|
||||
360
|
||||
> fq -d mp3 '.headers._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._len | ., type, length?' /test.mp3
|
||||
360
|
||||
"number"
|
||||
360
|
||||
> fq -d mp3 '.headers._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._name | ., type, length?' /test.mp3
|
||||
"headers"
|
||||
"string"
|
||||
7
|
||||
> fq -d mp3 '.headers._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._symbol | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._description | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers"
|
||||
]
|
||||
"array"
|
||||
1
|
||||
> fq -d mp3 '.headers._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._bits | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|
|
||||
<360 bits>
|
||||
"buffer"
|
||||
360
|
||||
> fq -d mp3 '.headers._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._bytes | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|
|
||||
<45 bytes>
|
||||
"buffer"
|
||||
45
|
||||
> fq -d mp3 '.headers._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
56
pkg/interp/testdata/value_boolean.fqtest
vendored
56
pkg/interp/testdata/value_boolean.fqtest
vendored
@ -1,106 +1,106 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | ., tovalue, type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0| 00 | . |.headers[0].flags.unsynchronisation: false
|
||||
false
|
||||
"boolean"
|
||||
# index
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[0] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[-1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
# slice
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[1:3] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[0:-1] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation[-1000:2000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: boolean
|
||||
# key
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation["test"] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an object but got: boolean
|
||||
# each
|
||||
> fq -d mp3 '[.headers[0].flags.unsynchronisation[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[0].flags.unsynchronisation[]] | type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot iterate over: boolean
|
||||
# keys
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | keys' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: keys cannot be applied to: boolean
|
||||
# has
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | has("a")' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: boolean
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | has(0)' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: boolean
|
||||
# type
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | type' /test.mp3
|
||||
"boolean"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: boolean
|
||||
# tostring
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation | tostring' /test.mp3
|
||||
"false"
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation + ""' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: boolean (false) and string ("")
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation + 1' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: boolean (false) and number (1)
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._start | ., type, length?' /test.mp3
|
||||
40
|
||||
"number"
|
||||
40
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._stop | ., type, length?' /test.mp3
|
||||
41
|
||||
"number"
|
||||
41
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._len | ., type, length?' /test.mp3
|
||||
1
|
||||
"number"
|
||||
1
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._name | ., type, length?' /test.mp3
|
||||
"unsynchronisation"
|
||||
"string"
|
||||
17
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._symbol | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._description | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers",
|
||||
0,
|
||||
@ -109,22 +109,22 @@ error: cannot add: boolean (false) and number (1)
|
||||
]
|
||||
"array"
|
||||
4
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._bits | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 |. |
|
||||
<1 bits>
|
||||
"buffer"
|
||||
1
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._bytes | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 |. |
|
||||
<0 bytes>
|
||||
"buffer"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags.unsynchronisation._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags.unsynchronisation._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
56
pkg/interp/testdata/value_null.fqtest
vendored
56
pkg/interp/testdata/value_null.fqtest
vendored
@ -1,103 +1,103 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers[0].padding | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | ., tovalue, type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x20| 00 00 00 00 00 00 00 00 00 00 | .......... |.headers[0].padding: Correct (none) (zero padding)
|
||||
null
|
||||
"null"
|
||||
0
|
||||
# index
|
||||
> fq -d mp3 '.headers[0].padding[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[0] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
> fq -d mp3 '.headers[0].padding[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[-1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
> fq -d mp3 '.headers[0].padding[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
# slice
|
||||
> fq -d mp3 '.headers[0].padding[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[1:3] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
> fq -d mp3 '.headers[0].padding[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[0:-1] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
> fq -d mp3 '.headers[0].padding[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding[-1000:2000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: null
|
||||
# key
|
||||
> fq -d mp3 '.headers[0].padding["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding["test"] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an object but got: null
|
||||
# each
|
||||
> fq -d mp3 '[.headers[0].padding[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[0].padding[]] | type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot iterate over: null
|
||||
# keys
|
||||
> fq -d mp3 '.headers[0].padding | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | keys' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: keys cannot be applied to: null
|
||||
# has
|
||||
> fq -d mp3 '.headers[0].padding | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | has("a")' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: null
|
||||
> fq -d mp3 '.headers[0].padding | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | has(0)' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: null
|
||||
# type
|
||||
> fq -d mp3 '.headers[0].padding | type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | type' /test.mp3
|
||||
"null"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers[0].padding | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: null
|
||||
# tostring
|
||||
> fq -d mp3 '.headers[0].padding | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding | tostring' /test.mp3
|
||||
"null"
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers[0].padding + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding + ""' /test.mp3
|
||||
""
|
||||
> fq -d mp3 '.headers[0].padding + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding + 1' /test.mp3
|
||||
1
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers[0].padding._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._start | ., type, length?' /test.mp3
|
||||
280
|
||||
"number"
|
||||
280
|
||||
> fq -d mp3 '.headers[0].padding._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._stop | ., type, length?' /test.mp3
|
||||
360
|
||||
"number"
|
||||
360
|
||||
> fq -d mp3 '.headers[0].padding._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._len | ., type, length?' /test.mp3
|
||||
80
|
||||
"number"
|
||||
80
|
||||
> fq -d mp3 '.headers[0].padding._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._name | ., type, length?' /test.mp3
|
||||
"padding"
|
||||
"string"
|
||||
7
|
||||
> fq -d mp3 '.headers[0].padding._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._symbol | ., type, length?' /test.mp3
|
||||
"Correct"
|
||||
"string"
|
||||
7
|
||||
> fq -d mp3 '.headers[0].padding._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._description | ., type, length?' /test.mp3
|
||||
"zero padding"
|
||||
"string"
|
||||
12
|
||||
> fq -d mp3 '.headers[0].padding._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers",
|
||||
0,
|
||||
@ -105,22 +105,22 @@ error: tonumber cannot be applied to: null
|
||||
]
|
||||
"array"
|
||||
3
|
||||
> fq -d mp3 '.headers[0].padding._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._bits | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 00 00 00 00 00 00 00 00 00 |.......... |
|
||||
<80 bits>
|
||||
"buffer"
|
||||
80
|
||||
> fq -d mp3 '.headers[0].padding._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._bytes | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 00 00 00 00 00 00 00 00 00 |.......... |
|
||||
<10 bytes>
|
||||
"buffer"
|
||||
10
|
||||
> fq -d mp3 '.headers[0].padding._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].padding._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].padding._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
56
pkg/interp/testdata/value_number.fqtest
vendored
56
pkg/interp/testdata/value_number.fqtest
vendored
@ -1,103 +1,103 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers[0].version | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | ., tovalue, type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0| 04 | . |.headers[0].version: 4
|
||||
4
|
||||
"number"
|
||||
4
|
||||
# index
|
||||
> fq -d mp3 '.headers[0].version[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[0] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
> fq -d mp3 '.headers[0].version[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[-1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
> fq -d mp3 '.headers[0].version[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
# slice
|
||||
> fq -d mp3 '.headers[0].version[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[1:3] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
> fq -d mp3 '.headers[0].version[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[0:-1] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
> fq -d mp3 '.headers[0].version[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version[-1000:2000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: number
|
||||
# key
|
||||
> fq -d mp3 '.headers[0].version["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version["test"] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an object but got: number
|
||||
# each
|
||||
> fq -d mp3 '[.headers[0].version[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[0].version[]] | type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot iterate over: number
|
||||
# keys
|
||||
> fq -d mp3 '.headers[0].version | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | keys' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: keys cannot be applied to: number
|
||||
# has
|
||||
> fq -d mp3 '.headers[0].version | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | has("a")' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: number
|
||||
> fq -d mp3 '.headers[0].version | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | has(0)' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: number
|
||||
# type
|
||||
> fq -d mp3 '.headers[0].version | type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | type' /test.mp3
|
||||
"number"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers[0].version | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | tonumber' /test.mp3
|
||||
4
|
||||
# tostring
|
||||
> fq -d mp3 '.headers[0].version | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version | tostring' /test.mp3
|
||||
"4"
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers[0].version + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version + ""' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: number (4) and string ("")
|
||||
> fq -d mp3 '.headers[0].version + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version + 1' /test.mp3
|
||||
5
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers[0].version._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._start | ., type, length?' /test.mp3
|
||||
24
|
||||
"number"
|
||||
24
|
||||
> fq -d mp3 '.headers[0].version._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._stop | ., type, length?' /test.mp3
|
||||
32
|
||||
"number"
|
||||
32
|
||||
> fq -d mp3 '.headers[0].version._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._len | ., type, length?' /test.mp3
|
||||
8
|
||||
"number"
|
||||
8
|
||||
> fq -d mp3 '.headers[0].version._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._name | ., type, length?' /test.mp3
|
||||
"version"
|
||||
"string"
|
||||
7
|
||||
> fq -d mp3 '.headers[0].version._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._symbol | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].version._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._description | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].version._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers",
|
||||
0,
|
||||
@ -105,22 +105,22 @@ error: cannot add: number (4) and string ("")
|
||||
]
|
||||
"array"
|
||||
3
|
||||
> fq -d mp3 '.headers[0].version._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._bits | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|04 |. |
|
||||
<8 bits>
|
||||
"buffer"
|
||||
8
|
||||
> fq -d mp3 '.headers[0].version._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._bytes | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|04 |. |
|
||||
<1 bytes>
|
||||
"buffer"
|
||||
1
|
||||
> fq -d mp3 '.headers[0].version._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].version._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].version._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
56
pkg/interp/testdata/value_object.fqtest
vendored
56
pkg/interp/testdata/value_object.fqtest
vendored
@ -1,6 +1,6 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers[0].flags | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | ., tovalue, type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.headers[0].flags: {}
|
||||
0x0| 00 | . | unsynchronisation: false
|
||||
0x0| 00 | . | extended_header: false
|
||||
@ -15,42 +15,42 @@
|
||||
"object"
|
||||
4
|
||||
# index
|
||||
> fq -d mp3 '.headers[0].flags[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[0] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array with index 0 but got: object
|
||||
> fq -d mp3 '.headers[0].flags[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[-1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array with index -2 but got: object
|
||||
> fq -d mp3 '.headers[0].flags[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[1000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array with index -1 but got: object
|
||||
# slice
|
||||
> fq -d mp3 '.headers[0].flags[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[1:3] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: object
|
||||
> fq -d mp3 '.headers[0].flags[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[0:-1] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: object
|
||||
> fq -d mp3 '.headers[0].flags[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags[-1000:2000] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an array but got: object
|
||||
# key
|
||||
> fq -d mp3 '.headers[0].flags["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags["test"] | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
# each
|
||||
> fq -d mp3 '[.headers[0].flags[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[0].flags[]] | type, length?' /test.mp3
|
||||
"array"
|
||||
4
|
||||
# keys
|
||||
> fq -d mp3 '.headers[0].flags | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | keys' /test.mp3
|
||||
[
|
||||
"unsynchronisation",
|
||||
"extended_header",
|
||||
@ -58,60 +58,60 @@ null
|
||||
"unused"
|
||||
]
|
||||
# has
|
||||
> fq -d mp3 '.headers[0].flags | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | has("a")' /test.mp3
|
||||
false
|
||||
> fq -d mp3 '.headers[0].flags | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | has(0)' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot check whether object has a key: 0
|
||||
# type
|
||||
> fq -d mp3 '.headers[0].flags | type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | type' /test.mp3
|
||||
"object"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers[0].flags | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tonumber cannot be applied to: object
|
||||
# tostring
|
||||
> fq -d mp3 '.headers[0].flags | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags | tostring' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: tostring cannot be applied to: object
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers[0].flags + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags + ""' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: object ({"experimental_indicator" ...}) and string ("")
|
||||
> fq -d mp3 '.headers[0].flags + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags + 1' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: object ({"experimental_indicator" ...}) and number (1)
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers[0].flags._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._start | ., type, length?' /test.mp3
|
||||
40
|
||||
"number"
|
||||
40
|
||||
> fq -d mp3 '.headers[0].flags._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._stop | ., type, length?' /test.mp3
|
||||
48
|
||||
"number"
|
||||
48
|
||||
> fq -d mp3 '.headers[0].flags._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._len | ., type, length?' /test.mp3
|
||||
8
|
||||
"number"
|
||||
8
|
||||
> fq -d mp3 '.headers[0].flags._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._name | ., type, length?' /test.mp3
|
||||
"flags"
|
||||
"string"
|
||||
5
|
||||
> fq -d mp3 '.headers[0].flags._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._symbol | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._description | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers",
|
||||
0,
|
||||
@ -119,22 +119,22 @@ error: cannot add: object ({"experimental_indicator" ...}) and number (1)
|
||||
]
|
||||
"array"
|
||||
3
|
||||
> fq -d mp3 '.headers[0].flags._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._bits | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 |. |
|
||||
<8 bits>
|
||||
"buffer"
|
||||
8
|
||||
> fq -d mp3 '.headers[0].flags._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._bytes | ., type, length?' /test.mp3
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
||||
0x0|00 |. |
|
||||
<1 bytes>
|
||||
"buffer"
|
||||
1
|
||||
> fq -d mp3 '.headers[0].flags._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].flags._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].flags._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
56
pkg/interp/testdata/value_string.fqtest
vendored
56
pkg/interp/testdata/value_string.fqtest
vendored
@ -1,105 +1,105 @@
|
||||
/test.mp3:
|
||||
# display
|
||||
> fq -d mp3 '.headers[0].magic | ., tovalue, type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | ., tovalue, type, length?' /test.mp3
|
||||
|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)
|
||||
"ID3"
|
||||
"string"
|
||||
3
|
||||
# index
|
||||
> fq -d mp3 '.headers[0].magic[0] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[0] | ., type, length?' /test.mp3
|
||||
"I"
|
||||
"string"
|
||||
1
|
||||
> fq -d mp3 '.headers[0].magic[-1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[-1000] | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].magic[1000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[1000] | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
# slice
|
||||
> fq -d mp3 '.headers[0].magic[1:3] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[1:3] | ., type, length?' /test.mp3
|
||||
"D3"
|
||||
"string"
|
||||
2
|
||||
> fq -d mp3 '.headers[0].magic[0:-1] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[0:-1] | ., type, length?' /test.mp3
|
||||
"ID"
|
||||
"string"
|
||||
2
|
||||
> fq -d mp3 '.headers[0].magic[-1000:2000] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic[-1000:2000] | ., type, length?' /test.mp3
|
||||
"ID3"
|
||||
"string"
|
||||
3
|
||||
# key
|
||||
> fq -d mp3 '.headers[0].magic["test"] | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic["test"] | ., type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: expected an object but got: string
|
||||
# each
|
||||
> fq -d mp3 '[.headers[0].magic[]] | type, length?' /test.mp3
|
||||
$ fq -d mp3 '[.headers[0].magic[]] | type, length?' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot iterate over: string
|
||||
# keys
|
||||
> fq -d mp3 '.headers[0].magic | keys' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | keys' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: keys cannot be applied to: string
|
||||
# has
|
||||
> fq -d mp3 '.headers[0].magic | has("a")' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | has("a")' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: string
|
||||
> fq -d mp3 '.headers[0].magic | has(0)' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | has(0)' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: has cannot be applied to: string
|
||||
# type
|
||||
> fq -d mp3 '.headers[0].magic | type' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | type' /test.mp3
|
||||
"string"
|
||||
# tonumber
|
||||
> fq -d mp3 '.headers[0].magic | tonumber' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | tonumber' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: invalid number: "ID3"
|
||||
# tostring
|
||||
> fq -d mp3 '.headers[0].magic | tostring' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic | tostring' /test.mp3
|
||||
"ID3"
|
||||
# to gojq
|
||||
> fq -d mp3 '.headers[0].magic + ""' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic + ""' /test.mp3
|
||||
"ID3"
|
||||
> fq -d mp3 '.headers[0].magic + 1' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic + 1' /test.mp3
|
||||
exitcode: 5
|
||||
stderr:
|
||||
error: cannot add: string ("ID3") and number (1)
|
||||
# test _keys
|
||||
> fq -d mp3 '.headers[0].magic._start | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._start | ., type, length?' /test.mp3
|
||||
0
|
||||
"number"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].magic._stop | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._stop | ., type, length?' /test.mp3
|
||||
24
|
||||
"number"
|
||||
24
|
||||
> fq -d mp3 '.headers[0].magic._len | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._len | ., type, length?' /test.mp3
|
||||
24
|
||||
"number"
|
||||
24
|
||||
> fq -d mp3 '.headers[0].magic._name | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._name | ., type, length?' /test.mp3
|
||||
"magic"
|
||||
"string"
|
||||
5
|
||||
> fq -d mp3 '.headers[0].magic._symbol | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._symbol | ., type, length?' /test.mp3
|
||||
""
|
||||
"string"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].magic._description | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._description | ., type, length?' /test.mp3
|
||||
"Correct"
|
||||
"string"
|
||||
7
|
||||
> fq -d mp3 '.headers[0].magic._path | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._path | ., type, length?' /test.mp3
|
||||
[
|
||||
"headers",
|
||||
0,
|
||||
@ -107,22 +107,22 @@ error: cannot add: string ("ID3") and number (1)
|
||||
]
|
||||
"array"
|
||||
3
|
||||
> fq -d mp3 '.headers[0].magic._bits | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bits | ., type, length?' /test.mp3
|
||||
|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
|
||||
> fq -d mp3 '.headers[0].magic._bytes | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._bytes | ., type, length?' /test.mp3
|
||||
|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
|
||||
> fq -d mp3 '.headers[0].magic._error | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._error | ., type, length?' /test.mp3
|
||||
null
|
||||
"null"
|
||||
0
|
||||
> fq -d mp3 '.headers[0].magic._unknown | ., type, length?' /test.mp3
|
||||
$ fq -d mp3 '.headers[0].magic._unknown | ., type, length?' /test.mp3
|
||||
false
|
||||
"boolean"
|
||||
|
2
pkg/interp/testdata/version.fqtest
vendored
2
pkg/interp/testdata/version.fqtest
vendored
@ -1,2 +1,2 @@
|
||||
> fq -v
|
||||
$ fq -v
|
||||
dev
|
||||
|
Loading…
Reference in New Issue
Block a user