Port "test5" to littlecheck

Put the switch-related stuff in switch.fish, and the wildcard-related
stuff in wildcard.fish.
This commit is contained in:
Fabian Homborg 2020-02-08 10:43:40 +01:00
parent e3ccc310e2
commit 109a8b07a7
5 changed files with 45 additions and 44 deletions

View File

@ -69,3 +69,34 @@ end
#CHECKERR: fish: 'case' builtin not inside of switch block
#CHECKERR: case a
#CHECKERR: ^
set smurf green
switch $smurf;
case "*ee*"
echo Test 1 pass
case "*"
echo Test 1 fail
end;
#CHECK: Test 1 pass
switch $smurf
case *ee*
echo Test 2 fail
case red green blue
echo Test 2 pass
case "*"
echo Test 2 fail
end
#CHECKERR: {{.*}}switch.fish (line {{\d+}}): No matches for wildcard '*ee*'. See `help expand`.
#CHECKERR: case *ee*
#CHECKERR: ^
#CHECK: Test 2 pass
switch $smurf
case cyan magenta yellow
echo Test 3 fail
case "*"
echo Test 3 pass
end
#CHECK: Test 3 pass

View File

@ -15,3 +15,17 @@ echo $dirs/*.txt
cd $oldpwd
rm -Rf $dir
# Verify that we can do wildcard expansion when we
# don't have read access to some path components
# See #2099
set -l where ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess
mkdir -p $where
chmod 300 (dirname $where) # no read permissions
mkdir -p $where
touch $where/alpha.txt $where/beta.txt $where/delta.txt
echo $where/*
#CHECK: ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/alpha.txt ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/beta.txt ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/delta.txt
chmod 700 (dirname $where) # so we can delete it
rm -rf ../test/temp/fish_wildcard_permissions_test

View File

@ -1,3 +0,0 @@
fish: No matches for wildcard '*ee*'. See `help expand`.
case *ee*
^

View File

@ -1,37 +0,0 @@
set smurf green
switch $smurf;
case "*ee*"
echo Test 1 pass
case "*"
echo Test 1 fail
end;
switch $smurf
case *ee*
echo Test 2 fail
case red green blue
echo Test 2 pass
case "*"
echo Test 2 fail
end
switch $smurf
case cyan magenta yellow
echo Test 3 fail
case "*"
echo Test 3 pass
end
# Verify that we can do wildcard expansion when we
# don't have read access to some path components
# See #2099
set -l where ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess
mkdir -p $where
chmod 300 (dirname $where) # no read permissions
mkdir -p $where
touch $where/alpha.txt $where/beta.txt $where/delta.txt
echo $where/*
chmod 700 (dirname $where) # so we can delete it
rm -rf ../test/temp/fish_wildcard_permissions_test

View File

@ -1,4 +0,0 @@
Test 1 pass
Test 2 pass
Test 3 pass
../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/alpha.txt ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/beta.txt ../test/temp/fish_wildcard_permissions_test/noaccess/yesaccess/delta.txt