Fix tests for macos

This commit is contained in:
Ilan Cosman 2020-08-10 15:11:02 -07:00
parent 429625f979
commit 7e2b7cbca3
4 changed files with 16 additions and 23 deletions

View File

@ -40,10 +40,10 @@ function _tide_sub_test
return 1
end
for test in $argv
fishtape "$testsDir/$test.fish" >$pending
sudo --validate # Cache sudo credentials
if test $status -eq 0
for test in $argv
if fishtape "$testsDir/$test.fish" >$pending
if set -q _flag_verbose
cat $pending >>$passed
else
@ -54,24 +54,18 @@ function _tide_sub_test
end
end
if test -e $failed
printf '%s\n' '--------FAILED--------'
cat $failed
rm $failed
set returnStatement 1
end
if test -e $passed
printf '%s\n' '--------PASSED--------'
cat $passed
rm $passed
end
if test -e $failed
printf '%s\n' '--------FAILED--------'
cat $failed
rm $failed
if test -e $pending
rm $pending
return 1
end
return $returnStatement
end
function _tide_test_help

View File

@ -9,7 +9,7 @@ end
# Unwritable directories
sudo mkdir --parents ~/unwritable/dir # Uses sudo to make the dir unwritable
sudo mkdir -p ~/unwritable/dir # Uses sudo to make the dir unwritable
set -lx tide_pwd_unwritable_icon ''
@ -26,7 +26,7 @@ set -lx tide_pwd_unwritable_icon
# Normal directories
mkdir --parents ~/normal/dir
mkdir -p ~/normal/dir
@test '~' (_pwd ~) = '~'
@test '~/normal' (_pwd ~/normal) = '~/normal'
@ -37,7 +37,7 @@ rm -rf ~/normal
# Long directories
set -l longDir ~/alfa/bravo/charlie/delta/echo/foxtrot/golf/hotel/inda/juliett/kilo/lima/mike/november/oscar/papa
mkdir --parents $longDir
mkdir -p $longDir
@test 'Long dir' (_pwd "$longDir") = '~/a/b/c/d/e/f/g/hotel/inda/juliett/kilo/lima/mike/november/oscar/papa'

View File

@ -2,17 +2,16 @@
function _time -a format
set -lx tide_time_format $format
sudo date --set='25 SEP 2002 12:00:00' >/dev/null # My birthday!
sudo date 092512002002 >/dev/null # My birthday!
_tide_decolor (_tide_item_time)
end
# Changing the date can mess with things, so we remember the correct one
# and set it back afterwards. Use sudo to cache permissions so that the clock
# will be less off. This test will still put your clock off by a few seconds though.
set -l actualTime (sudo date)
# and set it back afterwards. This test will still put your clock off by a few seconds though.
set -l actualTime (date +"%m%d%H%M%y")
@test 'No format' (_time '') -z
@test '24 Hour' (_time '%T') = "12:00:00"
@test '12 Hour' (_time '%r') = "12:00:00 PM"
sudo date --set=$actualTime >/dev/null
sudo date $actualTime >/dev/null

View File

@ -6,7 +6,7 @@ end
set -l dir ~/python_project
mkdir --parents $dir
mkdir -p $dir
cd $dir
@test 'nothing' (_virtual_env) -z