From 8dc0f06b62b43f7a1cc6794173800ca130244252 Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Fri, 13 Aug 2021 16:40:28 +0200 Subject: [PATCH] cli: Add completion tests --- format/flac/testdata/frame.fqtest | 2 +- format/flac/testdata/mono16.fqtest | 2 +- format/flac/testdata/mono24.fqtest | 2 +- format/flac/testdata/mono8.fqtest | 2 +- format/flac/testdata/picture_seek_gain.fqtest | 2 +- format/flac/testdata/stereo16.fqtest | 2 +- format/flac/testdata/stereo24.fqtest | 2 +- format/flac/testdata/stereo8.fqtest | 2 +- format/gif/testdata/4x4.fqtest | 2 +- format/gzip/testdata/test.fqtest | 2 +- format/icc/testdata/sRGB2014.fqtest | 2 +- format/id3/testdata/apic.fqtest | 2 +- format/id3/testdata/id3v1.fqtest | 2 +- format/id3/testdata/id3v23.fqtest | 2 +- format/id3/testdata/id3v24.fqtest | 2 +- format/id3/testdata/utf16-apic.fqtest | 2 +- format/jpeg/testdata/4x4.fqtest | 2 +- format/json/testdata/json.fqtest | 14 ++-- format/matroska/testdata/aac.fqtest | 2 +- format/matroska/testdata/av1.fqtest | 2 +- format/matroska/testdata/avc.fqtest | 2 +- format/matroska/testdata/flac.fqtest | 2 +- format/matroska/testdata/hevc.fqtest | 2 +- format/matroska/testdata/mp3.fqtest | 2 +- format/matroska/testdata/mpeg2.fqtest | 2 +- format/matroska/testdata/opus.fqtest | 2 +- format/matroska/testdata/path.fqtest | 4 +- format/matroska/testdata/vorbis.fqtest | 2 +- format/matroska/testdata/vp8.fqtest | 2 +- format/matroska/testdata/vp9.fqtest | 2 +- .../mp3/testdata/header-zeros-frames.fqtest | 2 +- format/mp3/testdata/headerfooter.fqtest | 2 +- format/mp3/testdata/test.fqtest | 4 +- format/mp3/testdata/xing.fqtest | 2 +- format/mp4/testdata/aac.fqtest | 2 +- format/mp4/testdata/av1.fqtest | 2 +- format/mp4/testdata/avc.fqtest | 2 +- format/mp4/testdata/flac.fqtest | 2 +- format/mp4/testdata/fragmented.fqtest | 2 +- format/mp4/testdata/heic.fqtest | 2 +- format/mp4/testdata/hevc.fqtest | 2 +- format/mp4/testdata/mp3.fqtest | 2 +- format/mp4/testdata/mpeg2.fqtest | 2 +- format/mp4/testdata/opus.fqtest | 2 +- format/mp4/testdata/path.fqtest | 4 +- format/mp4/testdata/vorbis.fqtest | 2 +- format/mp4/testdata/vp9.fqtest | 2 +- format/mpeg/testdata/adts.fqtest | 2 +- .../mpeg/testdata/mp3-frame-mono-crc.fqtest | 2 +- format/mpeg/testdata/mp3-frame-mono.fqtest | 2 +- format/mpeg/testdata/mp3-frame-stereo.fqtest | 2 +- format/ogg/testdata/page.fqtest | 2 +- format/ogg/testdata/test.fqtest | 2 +- format/opus/testdata/opus.fqtest | 6 +- format/png/testdata/4x4.fqtest | 2 +- format/png/testdata/4x4a.fqtest | 2 +- format/tiff/testdata/4x4.fqtest | 2 +- format/vorbis/testdata/vorbis.fqtest | 8 +-- format/wav/testdata/end-of-file.fqtest | 2 +- format/wav/testdata/stereo.fqtest | 2 +- format/webp/testdata/4x4.fqtest | 2 +- pkg/fqtest/fqtest.go | 66 ++++++++++++------- pkg/fqtest/fqtest_test.go | 4 +- pkg/interp/testdata/args.fqtest | 28 ++++---- pkg/interp/testdata/basic.fqtest | 20 +++--- pkg/interp/testdata/buffer.fqtest | 26 ++++---- pkg/interp/testdata/completion.fqtest | 36 ++++++++++ pkg/interp/testdata/configinit.fqtest | 2 +- pkg/interp/testdata/display.fqtest | 12 ++-- pkg/interp/testdata/exitcode.fqtest | 12 ++-- pkg/interp/testdata/gojq.fqtest | 22 +++---- pkg/interp/testdata/hexdump.fqtest | 6 +- pkg/interp/testdata/inputs.fqtest | 30 ++++----- pkg/interp/testdata/noconfiginit.fqtest | 2 +- pkg/interp/testdata/output.fqtest | 18 ++--- pkg/interp/testdata/scriptfile.fqtest | 4 +- pkg/interp/testdata/value.fqtest | 42 ++++++------ pkg/interp/testdata/value_array.fqtest | 56 ++++++++-------- pkg/interp/testdata/value_boolean.fqtest | 56 ++++++++-------- pkg/interp/testdata/value_null.fqtest | 56 ++++++++-------- pkg/interp/testdata/value_number.fqtest | 56 ++++++++-------- pkg/interp/testdata/value_object.fqtest | 56 ++++++++-------- pkg/interp/testdata/value_string.fqtest | 56 ++++++++-------- pkg/interp/testdata/version.fqtest | 2 +- 84 files changed, 438 insertions(+), 380 deletions(-) create mode 100644 pkg/interp/testdata/completion.fqtest diff --git a/format/flac/testdata/frame.fqtest b/format/flac/testdata/frame.fqtest index 2b31c321..ba652649 100644 --- a/format/flac/testdata/frame.fqtest +++ b/format/flac/testdata/frame.fqtest @@ -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) diff --git a/format/flac/testdata/mono16.fqtest b/format/flac/testdata/mono16.fqtest index e7077733..5a87c881 100644 --- a/format/flac/testdata/mono16.fqtest +++ b/format/flac/testdata/mono16.fqtest @@ -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) diff --git a/format/flac/testdata/mono24.fqtest b/format/flac/testdata/mono24.fqtest index 233d9818..32b00462 100644 --- a/format/flac/testdata/mono24.fqtest +++ b/format/flac/testdata/mono24.fqtest @@ -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) diff --git a/format/flac/testdata/mono8.fqtest b/format/flac/testdata/mono8.fqtest index 34e95b05..e8c3ed6a 100644 --- a/format/flac/testdata/mono8.fqtest +++ b/format/flac/testdata/mono8.fqtest @@ -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) diff --git a/format/flac/testdata/picture_seek_gain.fqtest b/format/flac/testdata/picture_seek_gain.fqtest index e62d2895..8290b8b6 100644 --- a/format/flac/testdata/picture_seek_gain.fqtest +++ b/format/flac/testdata/picture_seek_gain.fqtest @@ -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) diff --git a/format/flac/testdata/stereo16.fqtest b/format/flac/testdata/stereo16.fqtest index 421eb2fe..47bf3276 100644 --- a/format/flac/testdata/stereo16.fqtest +++ b/format/flac/testdata/stereo16.fqtest @@ -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) diff --git a/format/flac/testdata/stereo24.fqtest b/format/flac/testdata/stereo24.fqtest index 7cc1b628..e46a8a4c 100644 --- a/format/flac/testdata/stereo24.fqtest +++ b/format/flac/testdata/stereo24.fqtest @@ -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) diff --git a/format/flac/testdata/stereo8.fqtest b/format/flac/testdata/stereo8.fqtest index 463412d5..1675d976 100644 --- a/format/flac/testdata/stereo8.fqtest +++ b/format/flac/testdata/stereo8.fqtest @@ -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) diff --git a/format/gif/testdata/4x4.fqtest b/format/gif/testdata/4x4.fqtest index 460d99f0..0527ad74 100644 --- a/format/gif/testdata/4x4.fqtest +++ b/format/gif/testdata/4x4.fqtest @@ -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) diff --git a/format/gzip/testdata/test.fqtest b/format/gzip/testdata/test.fqtest index 78198205..64ced445 100644 --- a/format/gzip/testdata/test.fqtest +++ b/format/gzip/testdata/test.fqtest @@ -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) diff --git a/format/icc/testdata/sRGB2014.fqtest b/format/icc/testdata/sRGB2014.fqtest index d7178fb9..1c62fa54 100644 --- a/format/icc/testdata/sRGB2014.fqtest +++ b/format/icc/testdata/sRGB2014.fqtest @@ -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) diff --git a/format/id3/testdata/apic.fqtest b/format/id3/testdata/apic.fqtest index feb19c51..6b855424 100644 --- a/format/id3/testdata/apic.fqtest +++ b/format/id3/testdata/apic.fqtest @@ -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) diff --git a/format/id3/testdata/id3v1.fqtest b/format/id3/testdata/id3v1.fqtest index b1c26a01..e1518f4a 100644 --- a/format/id3/testdata/id3v1.fqtest +++ b/format/id3/testdata/id3v1.fqtest @@ -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) diff --git a/format/id3/testdata/id3v23.fqtest b/format/id3/testdata/id3v23.fqtest index a30d3cef..5ddf27a9 100644 --- a/format/id3/testdata/id3v23.fqtest +++ b/format/id3/testdata/id3v23.fqtest @@ -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) diff --git a/format/id3/testdata/id3v24.fqtest b/format/id3/testdata/id3v24.fqtest index 11ffcbc8..f1ba3b2c 100644 --- a/format/id3/testdata/id3v24.fqtest +++ b/format/id3/testdata/id3v24.fqtest @@ -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) diff --git a/format/id3/testdata/utf16-apic.fqtest b/format/id3/testdata/utf16-apic.fqtest index 6d14b94f..7eb34249 100644 --- a/format/id3/testdata/utf16-apic.fqtest +++ b/format/id3/testdata/utf16-apic.fqtest @@ -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) diff --git a/format/jpeg/testdata/4x4.fqtest b/format/jpeg/testdata/4x4.fqtest index 69e3ca1d..419d2c1f 100644 --- a/format/jpeg/testdata/4x4.fqtest +++ b/format/jpeg/testdata/4x4.fqtest @@ -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) diff --git a/format/json/testdata/json.fqtest b/format/json/testdata/json.fqtest index d73fab64..ab0732d6 100644 --- a/format/json/testdata/json.fqtest +++ b/format/json/testdata/json.fqtest @@ -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) diff --git a/format/matroska/testdata/aac.fqtest b/format/matroska/testdata/aac.fqtest index 114cbbea..e6e3dfac 100644 --- a/format/matroska/testdata/aac.fqtest +++ b/format/matroska/testdata/aac.fqtest @@ -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) diff --git a/format/matroska/testdata/av1.fqtest b/format/matroska/testdata/av1.fqtest index 6c834464..25f331e1 100644 --- a/format/matroska/testdata/av1.fqtest +++ b/format/matroska/testdata/av1.fqtest @@ -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) diff --git a/format/matroska/testdata/avc.fqtest b/format/matroska/testdata/avc.fqtest index a2fdfdd3..5f11ffcd 100644 --- a/format/matroska/testdata/avc.fqtest +++ b/format/matroska/testdata/avc.fqtest @@ -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) diff --git a/format/matroska/testdata/flac.fqtest b/format/matroska/testdata/flac.fqtest index c6e56831..9c9701bf 100644 --- a/format/matroska/testdata/flac.fqtest +++ b/format/matroska/testdata/flac.fqtest @@ -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) diff --git a/format/matroska/testdata/hevc.fqtest b/format/matroska/testdata/hevc.fqtest index 526217f5..8dc70923 100644 --- a/format/matroska/testdata/hevc.fqtest +++ b/format/matroska/testdata/hevc.fqtest @@ -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) diff --git a/format/matroska/testdata/mp3.fqtest b/format/matroska/testdata/mp3.fqtest index 8c4bddbe..50f078f1 100644 --- a/format/matroska/testdata/mp3.fqtest +++ b/format/matroska/testdata/mp3.fqtest @@ -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) diff --git a/format/matroska/testdata/mpeg2.fqtest b/format/matroska/testdata/mpeg2.fqtest index 2caaa3d6..cbdd9f5d 100644 --- a/format/matroska/testdata/mpeg2.fqtest +++ b/format/matroska/testdata/mpeg2.fqtest @@ -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) diff --git a/format/matroska/testdata/opus.fqtest b/format/matroska/testdata/opus.fqtest index f6ec2027..dc0744fa 100644 --- a/format/matroska/testdata/opus.fqtest +++ b/format/matroska/testdata/opus.fqtest @@ -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) diff --git a/format/matroska/testdata/path.fqtest b/format/matroska/testdata/path.fqtest index cfff2c6c..4d0cda5b 100644 --- a/format/matroska/testdata/path.fqtest +++ b/format/matroska/testdata/path.fqtest @@ -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" diff --git a/format/matroska/testdata/vorbis.fqtest b/format/matroska/testdata/vorbis.fqtest index d0a29283..3b8ebb57 100644 --- a/format/matroska/testdata/vorbis.fqtest +++ b/format/matroska/testdata/vorbis.fqtest @@ -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) diff --git a/format/matroska/testdata/vp8.fqtest b/format/matroska/testdata/vp8.fqtest index 01b6e633..b75c5c7d 100644 --- a/format/matroska/testdata/vp8.fqtest +++ b/format/matroska/testdata/vp8.fqtest @@ -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) diff --git a/format/matroska/testdata/vp9.fqtest b/format/matroska/testdata/vp9.fqtest index 9bfa0f00..3d5776d1 100644 --- a/format/matroska/testdata/vp9.fqtest +++ b/format/matroska/testdata/vp9.fqtest @@ -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) diff --git a/format/mp3/testdata/header-zeros-frames.fqtest b/format/mp3/testdata/header-zeros-frames.fqtest index 687bd4eb..053d335e 100644 --- a/format/mp3/testdata/header-zeros-frames.fqtest +++ b/format/mp3/testdata/header-zeros-frames.fqtest @@ -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) diff --git a/format/mp3/testdata/headerfooter.fqtest b/format/mp3/testdata/headerfooter.fqtest index 12191a6b..7b5584ae 100644 --- a/format/mp3/testdata/headerfooter.fqtest +++ b/format/mp3/testdata/headerfooter.fqtest @@ -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) diff --git a/format/mp3/testdata/test.fqtest b/format/mp3/testdata/test.fqtest index 400e228e..100afd8b 100644 --- a/format/mp3/testdata/test.fqtest +++ b/format/mp3/testdata/test.fqtest @@ -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) diff --git a/format/mp3/testdata/xing.fqtest b/format/mp3/testdata/xing.fqtest index edf03bb2..9a869a62 100644 --- a/format/mp3/testdata/xing.fqtest +++ b/format/mp3/testdata/xing.fqtest @@ -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) diff --git a/format/mp4/testdata/aac.fqtest b/format/mp4/testdata/aac.fqtest index 693bfd4e..5570c772 100644 --- a/format/mp4/testdata/aac.fqtest +++ b/format/mp4/testdata/aac.fqtest @@ -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) diff --git a/format/mp4/testdata/av1.fqtest b/format/mp4/testdata/av1.fqtest index eaa6ec99..3ea3ed1a 100644 --- a/format/mp4/testdata/av1.fqtest +++ b/format/mp4/testdata/av1.fqtest @@ -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) diff --git a/format/mp4/testdata/avc.fqtest b/format/mp4/testdata/avc.fqtest index 886a5725..fdc25d94 100644 --- a/format/mp4/testdata/avc.fqtest +++ b/format/mp4/testdata/avc.fqtest @@ -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) diff --git a/format/mp4/testdata/flac.fqtest b/format/mp4/testdata/flac.fqtest index 4894bd84..722c5e90 100644 --- a/format/mp4/testdata/flac.fqtest +++ b/format/mp4/testdata/flac.fqtest @@ -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) diff --git a/format/mp4/testdata/fragmented.fqtest b/format/mp4/testdata/fragmented.fqtest index b53528c5..4496bf14 100644 --- a/format/mp4/testdata/fragmented.fqtest +++ b/format/mp4/testdata/fragmented.fqtest @@ -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) diff --git a/format/mp4/testdata/heic.fqtest b/format/mp4/testdata/heic.fqtest index a2a11562..d1482dd1 100644 --- a/format/mp4/testdata/heic.fqtest +++ b/format/mp4/testdata/heic.fqtest @@ -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) diff --git a/format/mp4/testdata/hevc.fqtest b/format/mp4/testdata/hevc.fqtest index 57277371..b5de7dd8 100644 --- a/format/mp4/testdata/hevc.fqtest +++ b/format/mp4/testdata/hevc.fqtest @@ -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) diff --git a/format/mp4/testdata/mp3.fqtest b/format/mp4/testdata/mp3.fqtest index e4e1f4dc..a0f399ee 100644 --- a/format/mp4/testdata/mp3.fqtest +++ b/format/mp4/testdata/mp3.fqtest @@ -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) diff --git a/format/mp4/testdata/mpeg2.fqtest b/format/mp4/testdata/mpeg2.fqtest index 56c2e211..55c86203 100644 --- a/format/mp4/testdata/mpeg2.fqtest +++ b/format/mp4/testdata/mpeg2.fqtest @@ -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) diff --git a/format/mp4/testdata/opus.fqtest b/format/mp4/testdata/opus.fqtest index a90d62fc..06a6ed2a 100644 --- a/format/mp4/testdata/opus.fqtest +++ b/format/mp4/testdata/opus.fqtest @@ -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) diff --git a/format/mp4/testdata/path.fqtest b/format/mp4/testdata/path.fqtest index 9c64034d..7f608221 100644 --- a/format/mp4/testdata/path.fqtest +++ b/format/mp4/testdata/path.fqtest @@ -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]" diff --git a/format/mp4/testdata/vorbis.fqtest b/format/mp4/testdata/vorbis.fqtest index eba05ccc..9fc2d0ba 100644 --- a/format/mp4/testdata/vorbis.fqtest +++ b/format/mp4/testdata/vorbis.fqtest @@ -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) diff --git a/format/mp4/testdata/vp9.fqtest b/format/mp4/testdata/vp9.fqtest index 0624cf46..780e8b41 100644 --- a/format/mp4/testdata/vp9.fqtest +++ b/format/mp4/testdata/vp9.fqtest @@ -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) diff --git a/format/mpeg/testdata/adts.fqtest b/format/mpeg/testdata/adts.fqtest index 302ab873..71dd088c 100644 --- a/format/mpeg/testdata/adts.fqtest +++ b/format/mpeg/testdata/adts.fqtest @@ -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) diff --git a/format/mpeg/testdata/mp3-frame-mono-crc.fqtest b/format/mpeg/testdata/mp3-frame-mono-crc.fqtest index 09fd7f9b..d1eed30c 100644 --- a/format/mpeg/testdata/mp3-frame-mono-crc.fqtest +++ b/format/mpeg/testdata/mp3-frame-mono-crc.fqtest @@ -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) diff --git a/format/mpeg/testdata/mp3-frame-mono.fqtest b/format/mpeg/testdata/mp3-frame-mono.fqtest index ec8a999c..a1b41815 100644 --- a/format/mpeg/testdata/mp3-frame-mono.fqtest +++ b/format/mpeg/testdata/mp3-frame-mono.fqtest @@ -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) diff --git a/format/mpeg/testdata/mp3-frame-stereo.fqtest b/format/mpeg/testdata/mp3-frame-stereo.fqtest index 213ed6a3..0345bd98 100644 --- a/format/mpeg/testdata/mp3-frame-stereo.fqtest +++ b/format/mpeg/testdata/mp3-frame-stereo.fqtest @@ -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) diff --git a/format/ogg/testdata/page.fqtest b/format/ogg/testdata/page.fqtest index 6bae2e29..d0102b34 100644 --- a/format/ogg/testdata/page.fqtest +++ b/format/ogg/testdata/page.fqtest @@ -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) diff --git a/format/ogg/testdata/test.fqtest b/format/ogg/testdata/test.fqtest index 2ebaa759..e559fbdf 100644 --- a/format/ogg/testdata/test.fqtest +++ b/format/ogg/testdata/test.fqtest @@ -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) diff --git a/format/opus/testdata/opus.fqtest b/format/opus/testdata/opus.fqtest index fd704b5e..1d702db0 100644 --- a/format/opus/testdata/opus.fqtest +++ b/format/opus/testdata/opus.fqtest @@ -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) diff --git a/format/png/testdata/4x4.fqtest b/format/png/testdata/4x4.fqtest index 3eb8a7cb..ab6447a8 100644 --- a/format/png/testdata/4x4.fqtest +++ b/format/png/testdata/4x4.fqtest @@ -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) diff --git a/format/png/testdata/4x4a.fqtest b/format/png/testdata/4x4a.fqtest index 017c4380..d0b55818 100644 --- a/format/png/testdata/4x4a.fqtest +++ b/format/png/testdata/4x4a.fqtest @@ -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) diff --git a/format/tiff/testdata/4x4.fqtest b/format/tiff/testdata/4x4.fqtest index b24c82bd..7aed66ac 100644 --- a/format/tiff/testdata/4x4.fqtest +++ b/format/tiff/testdata/4x4.fqtest @@ -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) diff --git a/format/vorbis/testdata/vorbis.fqtest b/format/vorbis/testdata/vorbis.fqtest index e490b988..254c448f 100644 --- a/format/vorbis/testdata/vorbis.fqtest +++ b/format/vorbis/testdata/vorbis.fqtest @@ -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) diff --git a/format/wav/testdata/end-of-file.fqtest b/format/wav/testdata/end-of-file.fqtest index 033c8d45..59e519a4 100644 --- a/format/wav/testdata/end-of-file.fqtest +++ b/format/wav/testdata/end-of-file.fqtest @@ -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) diff --git a/format/wav/testdata/stereo.fqtest b/format/wav/testdata/stereo.fqtest index eedba0ae..547015d1 100644 --- a/format/wav/testdata/stereo.fqtest +++ b/format/wav/testdata/stereo.fqtest @@ -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) diff --git a/format/webp/testdata/4x4.fqtest b/format/webp/testdata/4x4.fqtest index 71be97b7..850f06e8 100644 --- a/format/webp/testdata/4x4.fqtest +++ b/format/webp/testdata/4x4.fqtest @@ -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) diff --git a/pkg/fqtest/fqtest.go b/pkg/fqtest/fqtest.go index 3547612d..3a5aae96 100644 --- a/pkg/fqtest/fqtest.go +++ b/pkg/fqtest/fqtest.go @@ -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, diff --git a/pkg/fqtest/fqtest_test.go b/pkg/fqtest/fqtest_test.go index 37646765..edfbd6d9 100644 --- a/pkg/fqtest/fqtest_test.go +++ b/pkg/fqtest/fqtest_test.go @@ -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)) } diff --git a/pkg/interp/testdata/args.fqtest b/pkg/interp/testdata/args.fqtest index 80a04627..ae197149 100644 --- a/pkg/interp/testdata/args.fqtest +++ b/pkg/interp/testdata/args.fqtest @@ -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 diff --git a/pkg/interp/testdata/basic.fqtest b/pkg/interp/testdata/basic.fqtest index 12907d0b..126eaf00 100644 --- a/pkg/interp/testdata/basic.fqtest +++ b/pkg/interp/testdata/basic.fqtest @@ -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", diff --git a/pkg/interp/testdata/buffer.fqtest b/pkg/interp/testdata/buffer.fqtest index 6dc05740..62b1aea5 100644 --- a/pkg/interp/testdata/buffer.fqtest +++ b/pkg/interp/testdata/buffer.fqtest @@ -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=" diff --git a/pkg/interp/testdata/completion.fqtest b/pkg/interp/testdata/completion.fqtest new file mode 100644 index 00000000..2512cf39 --- /dev/null +++ b/pkg/interp/testdata/completion.fqtest @@ -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 \ No newline at end of file diff --git a/pkg/interp/testdata/configinit.fqtest b/pkg/interp/testdata/configinit.fqtest index f6108474..1cbeca9a 100644 --- a/pkg/interp/testdata/configinit.fqtest +++ b/pkg/interp/testdata/configinit.fqtest @@ -1,4 +1,4 @@ /config/init.jq: def a: "a"; -> fq -n a +$ fq -n a "a" diff --git a/pkg/interp/testdata/display.fqtest b/pkg/interp/testdata/display.fqtest index 25c21af4..f5afb09e 100644 --- a/pkg/interp/testdata/display.fqtest +++ b/pkg/interp/testdata/display.fqtest @@ -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 |. | diff --git a/pkg/interp/testdata/exitcode.fqtest b/pkg/interp/testdata/exitcode.fqtest index ec72fa3e..70824b9b 100644 --- a/pkg/interp/testdata/exitcode.fqtest +++ b/pkg/interp/testdata/exitcode.fqtest @@ -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 -> fq . non-existing +$ fq . non-existing exitcode: 2 stderr: error: non-existing: file not found diff --git a/pkg/interp/testdata/gojq.fqtest b/pkg/interp/testdata/gojq.fqtest index 831fccb4..bc4b56d7 100644 --- a/pkg/interp/testdata/gojq.fqtest +++ b/pkg/interp/testdata/gojq.fqtest @@ -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", diff --git a/pkg/interp/testdata/hexdump.fqtest b/pkg/interp/testdata/hexdump.fqtest index 11a23beb..cba17f97 100644 --- a/pkg/interp/testdata/hexdump.fqtest +++ b/pkg/interp/testdata/hexdump.fqtest @@ -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 |@ | diff --git a/pkg/interp/testdata/inputs.fqtest b/pkg/interp/testdata/inputs.fqtest index 22cf5a9c..d4486d76 100644 --- a/pkg/interp/testdata/inputs.fqtest +++ b/pkg/interp/testdata/inputs.fqtest @@ -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 -> 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 diff --git a/pkg/interp/testdata/noconfiginit.fqtest b/pkg/interp/testdata/noconfiginit.fqtest index dc5afd3f..b23a3310 100644 --- a/pkg/interp/testdata/noconfiginit.fqtest +++ b/pkg/interp/testdata/noconfiginit.fqtest @@ -1,2 +1,2 @@ -> fq -n 1 +$ fq -n 1 1 diff --git a/pkg/interp/testdata/output.fqtest b/pkg/interp/testdata/output.fqtest index 54643419..62b04109 100644 --- a/pkg/interp/testdata/output.fqtest +++ b/pkg/interp/testdata/output.fqtest @@ -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" diff --git a/pkg/interp/testdata/scriptfile.fqtest b/pkg/interp/testdata/scriptfile.fqtest index 33320c42..d5c8428f 100644 --- a/pkg/interp/testdata/scriptfile.fqtest +++ b/pkg/interp/testdata/scriptfile.fqtest @@ -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" diff --git a/pkg/interp/testdata/value.fqtest b/pkg/interp/testdata/value.fqtest index 4b1fa5b3..6a8a3108 100644 --- a/pkg/interp/testdata/value.fqtest +++ b/pkg/interp/testdata/value.fqtest @@ -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| | diff --git a/pkg/interp/testdata/value_array.fqtest b/pkg/interp/testdata/value_array.fqtest index 8cfee4e9..09f9b94a 100644 --- a/pkg/interp/testdata/value_array.fqtest +++ b/pkg/interp/testdata/value_array.fqtest @@ -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" diff --git a/pkg/interp/testdata/value_boolean.fqtest b/pkg/interp/testdata/value_boolean.fqtest index c7d78c42..ba11dd34 100644 --- a/pkg/interp/testdata/value_boolean.fqtest +++ b/pkg/interp/testdata/value_boolean.fqtest @@ -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" diff --git a/pkg/interp/testdata/value_null.fqtest b/pkg/interp/testdata/value_null.fqtest index 4eeb5e7b..ee61a9ed 100644 --- a/pkg/interp/testdata/value_null.fqtest +++ b/pkg/interp/testdata/value_null.fqtest @@ -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" diff --git a/pkg/interp/testdata/value_number.fqtest b/pkg/interp/testdata/value_number.fqtest index 5b866711..4f3cc17c 100644 --- a/pkg/interp/testdata/value_number.fqtest +++ b/pkg/interp/testdata/value_number.fqtest @@ -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" diff --git a/pkg/interp/testdata/value_object.fqtest b/pkg/interp/testdata/value_object.fqtest index bcf5352b..c129c036 100644 --- a/pkg/interp/testdata/value_object.fqtest +++ b/pkg/interp/testdata/value_object.fqtest @@ -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" diff --git a/pkg/interp/testdata/value_string.fqtest b/pkg/interp/testdata/value_string.fqtest index 456b7bf8..cad87d63 100644 --- a/pkg/interp/testdata/value_string.fqtest +++ b/pkg/interp/testdata/value_string.fqtest @@ -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" diff --git a/pkg/interp/testdata/version.fqtest b/pkg/interp/testdata/version.fqtest index 54109bb6..aa2a1059 100644 --- a/pkg/interp/testdata/version.fqtest +++ b/pkg/interp/testdata/version.fqtest @@ -1,2 +1,2 @@ -> fq -v +$ fq -v dev