Skip to content

Commit

Permalink
fix: increase _fishtape_test_failed when file is invalid
Browse files Browse the repository at this point in the history
source ./functions/fishtape.fish; fishtape ./tests/invalid.fish

see #60
  • Loading branch information
edouard-lopez committed Jan 24, 2024
1 parent e6e5fc2 commit f7cbca0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ jobs:
run: |
curl -sL https://git.io/fisher | source
fisher install $GITHUB_WORKSPACE
fishtape tests/*
fishtape tests/invdalid.fish || true # should fail
fishtape (string match -v '*invalid*' -- tests/*)
shell: fish {0}
3 changes: 2 additions & 1 deletion functions/fishtape.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/invalid.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo === invalid ===

@test "a valid test but invalid file" true = true
end # we want to trigger a parsing error

0 comments on commit f7cbca0

Please sign in to comment.