mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 17:51:31 +08:00
Port andandoror test to littlecheck
This commit is contained in:
parent
8e11f802b4
commit
fdf0a661cf
|
@ -1,15 +0,0 @@
|
|||
|
||||
####################
|
||||
# Basic && and || support
|
||||
|
||||
####################
|
||||
# && and || in if statements
|
||||
|
||||
####################
|
||||
# && and || in while statements
|
||||
|
||||
####################
|
||||
# Nots
|
||||
|
||||
####################
|
||||
# Complex scenarios
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
####################
|
||||
# Basic && and || support
|
||||
first
|
||||
second
|
||||
third
|
||||
true && false: 1
|
||||
true || false: 0
|
||||
true && false || true: 0
|
||||
|
||||
####################
|
||||
# && and || in if statements
|
||||
if test 1 ok
|
||||
if test 2 ok
|
||||
if test 3 ok
|
||||
if test 4 ok
|
||||
|
||||
####################
|
||||
# && and || in while statements
|
||||
0 0 0
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
|
||||
####################
|
||||
# Nots
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
not !
|
||||
0
|
||||
|
||||
####################
|
||||
# Complex scenarios
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
|
@ -1,19 +1,30 @@
|
|||
logmsg "Basic && and || support"
|
||||
#RUN: %fish %s
|
||||
# "Basic && and || support"
|
||||
|
||||
echo first && echo second
|
||||
echo third || echo fourth
|
||||
true && false ; echo "true && false: $status"
|
||||
true || false ; echo "true || false: $status"
|
||||
true && false || true ; echo "true && false || true: $status"
|
||||
# CHECK: first
|
||||
# CHECK: second
|
||||
# CHECK: third
|
||||
# CHECK: true && false: 1
|
||||
# CHECK: true || false: 0
|
||||
# CHECK: true && false || true: 0
|
||||
|
||||
logmsg "&& and || in if statements"
|
||||
# "&& and || in if statements"
|
||||
|
||||
if true || false ; echo "if test 1 ok" ; end
|
||||
if true && false ; else; echo "if test 2 ok" ; end
|
||||
if true && false ; or true ; echo "if test 3 ok" ; end
|
||||
if [ 0 = 1 ] || [ 5 -ge 3 ] ; echo "if test 4 ok"; end
|
||||
# CHECK: if test 1 ok
|
||||
# CHECK: if test 2 ok
|
||||
# CHECK: if test 3 ok
|
||||
# CHECK: if test 4 ok
|
||||
|
||||
logmsg "&& and || in while statements"
|
||||
# "&& and || in while statements"
|
||||
|
||||
set alpha 0
|
||||
set beta 0
|
||||
|
@ -27,16 +38,27 @@ while [ $alpha -lt 2 ] && [ $beta -lt 3 ]
|
|||
set gamma ( math $gamma + 1 )
|
||||
set delta ( math $delta + 1 )
|
||||
end
|
||||
# CHECK: 0 0 0
|
||||
# CHECK: 1 1 1
|
||||
# CHECK: 2 2 2
|
||||
# CHECK: 3 3 3
|
||||
# CHECK: 4 4 4
|
||||
|
||||
logmsg "Nots"
|
||||
# "Nots"
|
||||
|
||||
true && ! false ; echo $status
|
||||
not true && ! false ; echo $status
|
||||
not not not true ; echo $status
|
||||
not ! ! not true ; echo $status
|
||||
not ! echo not ! ; echo $status
|
||||
# CHECK: 0
|
||||
# CHECK: 1
|
||||
# CHECK: 1
|
||||
# CHECK: 0
|
||||
# CHECK: not !
|
||||
# CHECK: 0
|
||||
|
||||
logmsg "Complex scenarios"
|
||||
# "Complex scenarios"
|
||||
|
||||
begin; echo 1 ; false ; end || begin ; echo 2 && echo 3 ; end
|
||||
|
||||
|
@ -44,3 +66,7 @@ if false && true
|
|||
or not false
|
||||
echo 4
|
||||
end
|
||||
# CHECK: 1
|
||||
# CHECK: 2
|
||||
# CHECK: 3
|
||||
# CHECK: 4
|
Loading…
Reference in New Issue
Block a user