fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmDeprecate builtin test's one- and zero-argument modes (#10365)2c17d3497

master
1.3 KiB48 linesraw
1# RUN: %fish %s
2#
3# Tests for the posix-mandated zero and one argument modes for the `test` builtin, aka `[`.
4
5test -n
6echo $status
7#CHECK: 0
8
9test -z
10echo $status
11#CHECK: 0
12
13test -d
14echo $status
15#CHECK: 0
16
17test "foo"
18echo $status
19#CHECK: 0
20
21test ""
22echo $status
23#CHECK: 1
24
25test -z "" -a foo
26echo $status
27#CHECK: 0
28
29set -l fish (status fish-path)
30echo 'test foo; test; test -z; test -n; test -d; echo oops' | $fish -d 'deprecated-*' >/dev/null
31#CHECKERR: test: called with one argument. This will return false in future.
32#CHECKERR: Standard input (line 1):
33#CHECKERR: test foo; test; test -z; test -n; test -d; echo oops
34#CHECKERR: ^
35#CHECKERR: test: called with no arguments. This will be an error in future.
36#CHECKERR: Standard input (line 1):
37#CHECKERR: test foo; test; test -z; test -n; test -d; echo oops
38#CHECKERR:           ^
39#CHECKERR: test: called with one argument. This will return false in future.
40# (yes, `test -z` is skipped because it would behave the same)
41#CHECKERR: Standard input (line 1):
42#CHECKERR: test foo; test; test -z; test -n; test -d; echo oops
43#CHECKERR:                          ^
44#CHECKERR: test: called with one argument. This will return false in future.
45#CHECKERR: Standard input (line 1):
46#CHECKERR: test foo; test; test -z; test -n; test -d; echo oops
47#CHECKERR: ^
48