diff --git a/pkg/interp/decode.jq b/pkg/interp/decode.jq index 6856b84f..a2692a35 100644 --- a/pkg/interp/decode.jq +++ b/pkg/interp/decode.jq @@ -49,7 +49,7 @@ def decode: decode(options.decode_format; {}); def topath: _decode_value(._path); def tovalue($opts): _tovalue(options($opts)); -def tovalue: _tovalue({}); +def tovalue: _tovalue(options({})); def toactual: _decode_value(._actual); def tosym: _decode_value(._sym); def todescription: _decode_value(._description); diff --git a/pkg/interp/testdata/tovalue.fqtest b/pkg/interp/testdata/tovalue.fqtest new file mode 100644 index 00000000..5a49e994 --- /dev/null +++ b/pkg/interp/testdata/tovalue.fqtest @@ -0,0 +1,5 @@ +$ fq -i +null> "aaa" | raw | .unknown0 | tovalue, tovalue({sizebase: 2}) +"<3>YWFh" +"<0b11>YWFh" +null> ^D diff --git a/pkg/interp/testdata/value_null.fqtest b/pkg/interp/testdata/value_null.fqtest index 26a5ecc9..1618e839 100644 --- a/pkg/interp/testdata/value_null.fqtest +++ b/pkg/interp/testdata/value_null.fqtest @@ -2,7 +2,7 @@ $ fq -i -d mp3 . /test.mp3 mp3> .headers[0].padding | ., tovalue, type, length? |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| 0x20| 00 00 00 00 00 00 00 00 00 00 | .......... |.headers[0].padding: raw bits (all zero) -"<0b1010>AAAAAAAAAAAAAA==" +"<10>AAAAAAAAAAAAAA==" "string" 10 mp3> .headers[0].padding[0] | ., type, length?