From 29f62116b3ec2c27e1d503ae3f57c0c0409a114b Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Wed, 20 Jan 2021 12:27:26 -0500 Subject: [PATCH] Clean up logic for failed 'not' file system tests --- functions/fishtape.fish | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/functions/fishtape.fish b/functions/fishtape.fish index cf1f05a..475c640 100644 --- a/functions/fishtape.fish +++ b/functions/fishtape.fish @@ -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