2024-04-12 18:19:32 +08:00
|
|
|
#RUN: %fish %s
|
2019-11-25 19:47:33 +08:00
|
|
|
|
|
|
|
set -xl LANG C # uniform quotes
|
|
|
|
|
|
|
|
eval 'true | and'
|
|
|
|
# CHECKERR: {{.*}}: The 'and' command can not be used in a pipeline
|
2022-08-12 23:04:30 +08:00
|
|
|
# CHECKERR: true | and
|
|
|
|
# CHECKERR: ^~^
|
2019-11-25 19:47:33 +08:00
|
|
|
|
|
|
|
eval 'true | or'
|
|
|
|
# CHECKERR: {{.*}}: The 'or' command can not be used in a pipeline
|
2022-08-12 23:04:30 +08:00
|
|
|
# CHECKERR: true | or
|
|
|
|
# CHECKERR: ^^
|
2020-02-08 22:37:10 +08:00
|
|
|
|
|
|
|
# Verify and/or behavior with if and while
|
2020-03-10 02:36:12 +08:00
|
|
|
if false; or true
|
|
|
|
echo success1
|
|
|
|
end
|
2020-02-08 22:37:10 +08:00
|
|
|
# CHECK: success1
|
2020-03-10 02:36:12 +08:00
|
|
|
if false; and false
|
|
|
|
echo failure1
|
|
|
|
end
|
|
|
|
while false; and false; or true
|
|
|
|
echo success2
|
|
|
|
break
|
|
|
|
end
|
2020-02-08 22:37:10 +08:00
|
|
|
# CHECK: success2
|
2020-03-10 02:36:12 +08:00
|
|
|
while false; or begin
|
|
|
|
false; or true
|
|
|
|
end
|
|
|
|
echo success3
|
|
|
|
break
|
|
|
|
end
|
2020-02-08 22:37:10 +08:00
|
|
|
# CHECK: success3
|
2020-03-10 02:36:12 +08:00
|
|
|
if false
|
|
|
|
else if false; and true
|
|
|
|
else if false; and false
|
|
|
|
else if false; or true
|
|
|
|
echo success4
|
|
|
|
end
|
2020-02-08 22:37:10 +08:00
|
|
|
# CHECK: success4
|
2020-03-10 02:36:12 +08:00
|
|
|
if false
|
|
|
|
else if false; and true
|
|
|
|
else if false; or false
|
|
|
|
else if false
|
|
|
|
echo "failure 4"
|
|
|
|
end
|
|
|
|
if false; or true | false
|
|
|
|
echo failure5
|
|
|
|
end
|