1
1
mirror of https://github.com/wader/fq.git synced 2024-11-28 03:02:55 +03:00
fq/pkg/interp/testdata/repl.fqtest
2021-09-12 13:08:56 +02:00

65 lines
873 B
Plaintext

$ fq -i
null> 1+1
2
null> (
error: repl:1:2: unexpected token <EOF>
null> abc
error: repl:1:0: function not defined: abc/0
null> 1+"a"
error: cannot add: number (1) and string ("a")
null> 1 | repl
> number> .+1
2
> number> ^D
null> 1 | 2 | repl
> number> .+1
3
> number> ^D
null> 1,2,3 | repl
> number, [3]> .
1
2
3
> number, [3]> ^D
null> def f: 1; f,f | repl
> number, [2]> .
1
1
> number, [2]> ^D
null> [1,2,3] | repl
> [number, ...][3]> .
[
1,
2,
3
]
> [number, ...][3]> ^D
null> [1] | repl
> [number]> .
[
1
]
> [number]> ^D
null> [] | repl
> []> ^D
null> ^D
$ fq -i 'empty'
empty> 1
empty> ^D
$ fq -i 1,2,3
number, [3]> .*2
2
4
6
number, [3]> ^D
$ fq -i '[1,2,3]'
[number, ...][3]> repl({compact: true})
> [number, ...][3]> tovalue
[1,2,3]
> [number, ...][3]> ^D
[number, ...][3]> ^D
$ fq -n repl
exitcode: 5
stderr:
error: repl can only be be used from repl