Skip to content

Commit

Permalink
Clean up logic for failed 'not' file system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmc3 committed Jan 20, 2021
1 parent ab2bfa7 commit 29f6211
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions functions/fishtape.fish
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,17 @@ function fishtape --description "Test scripts, functions, and plugins in Fish"
string replace --filter --regex -- "\s+called on line (\d+) of file (.+)" '$2:$1' |
read --local at

if test $argv[1] = "!"
set operator "! "
set negation "not "
set --erase argv[1]
end

if set --query argv[3]
if test $argv[1] = "!" && set --query argv[3]
set operator "$argv[1] $argv[2]"
set expected "not "$expectations[(contains --index -- $argv[2] $operators)]
set actual (string escape -- $argv[3])
else if set --query argv[3]
set operator "$operator"$argv[2]
set expected (string escape -- $argv[3])
set actual (string escape -- $argv[1])
else
set operator "$operator"$argv[1]
set expected "$negation"$expectations[(contains --index -- $argv[1] $operators)]
set operator $argv[1]
set expected $expectations[(contains --index -- $argv[1] $operators)]
set actual (string escape -- $argv[2])
end

Expand Down

0 comments on commit 29f6211

Please sign in to comment.