Install Fishtape via Fisher
mainInstall the Fishtape test runner for the Fish shell using the Fisher plugin manager.
fisher install jorgebucaran/fishtapefisher install jorgebucaran/fishtaperepository·main·Indexed 18 days ago
https://github.com/jorgebucaran/fishtapeA pure Fish shell test runner compliant with the Test Anything Protocol (TAP). It allows developers to test Fish scripts, functions, and plugins using the @test function for expressions and @echo for TAP comments.
Install the Fishtape test runner for the Fish shell using the Fisher plugin manager.
fisher install jorgebucaran/fishtapefisher install jorgebucaran/fishtapeFishtape outputs the Test Anything Protocol (TAP) by default. You can pipe this output into other TAP-compliant reporters for fancier visualizations.
Example (piping to tnyan):
$ fishtape test/* | tnyan$ fishtape test/* | tnyanWhen testing multiline output, you can either collapse newlines using echo or collect the input into a single argument using string collect.
Using echo:
@test "first six evens" (echo (seq 2 2 12)) = "2 4 6 8 10 12"Using string collect:
@test "one two three" (seq 3 | string collect) = "1\n2\n3"@test "first six evens" (echo (seq 2 2 12)) = "2 4 6 8 10 12"
@test "one two three" (seq 3 | string collect) = "1
2
3"If you need to write to stdout while tests are running without interfering with the TAP stream, use the @echo function. It is equivalent to echo "# $argv", which prints a valid TAP comment.
@echo -- strings --@echo -- strings --Tests are defined using the @test function. Each test consists of a description followed by a standard Fish test expression.
Syntax:
@test <description> [<actual>] <operator> <expected>
Important Notes:
-a or -o) are not currently supported.stdout to avoid cluttering the expression.Example:
@test "has a config.fish file" -e ~/.config/fish/config.fish
@test "the ultimate question" (math "6 * 7") -eq 42
@test "got root?" $USER = root
@test "repo is clean" (git diff-index --quiet @) $status -eq 0@test <description> [<actual>] <operator> <expected