From 5930860efc731a65ce884860e861159275063f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89douard=20Lopez?= Date: Wed, 24 Jan 2024 16:13:08 +0100 Subject: [PATCH] fix: increase _fishtape_test_failed when file is invalid source ./functions/fishtape.fish; fishtape ./tests/invalid.fish see #60 --- functions/fishtape.fish | 3 ++- tests/invalid.fish | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/invalid.fish diff --git a/functions/fishtape.fish b/functions/fishtape.fish index 7759f92..b15c2fe 100644 --- a/functions/fishtape.fish +++ b/functions/fishtape.fish @@ -94,7 +94,8 @@ function fishtape --description "Test scripts, functions, and plugins in Fish" echo TAP version 13 for file in $files - fish --init-command=(functions @echo | string collect) --init-command=(functions @test | string collect) $file + fish --init-command=(functions @echo | string collect) --init-command=(functions @test | string collect) $file \ + || set _fishtape_test_failed (math $_fishtape_test_failed + 1) end echo diff --git a/tests/invalid.fish b/tests/invalid.fish new file mode 100644 index 0000000..2653fab --- /dev/null +++ b/tests/invalid.fish @@ -0,0 +1,4 @@ +@echo === invalid === + +@test "nothing to see here" -z (true) +end # we want to trigger a parsing error