### Setup and Teardown with Temporary Directory Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Use `mktemp` to create a temporary directory for test setup and cleanup. Tests within this block operate within the isolated temporary environment. ```fish set temp (mktemp -d) cd $temp @test "a regular file" (touch file) -f file @test "nothing to see here" -z (read < file) rm -rf $temp ``` -------------------------------- ### Install Fishtape with Fisher Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Install the Fishtape test runner using the Fisher package manager for Fish shell. ```console fisher install jorgebucaran/fishtape ``` -------------------------------- ### Fishtape TAP Output Example Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md This console output demonstrates the Test Anything Protocol (TAP) stream generated by running Fishtape tests. It includes test results (ok/not ok), detailed failure information, and a summary of passed and failed tests. ```console $ fishtape example.fish TAP version 13 ok 1 has a config.fish file ok 2 the ultimate question not ok 3 got root? --- operator: = expected: root actual: jb at: ~/fishtape/tests/example.fish:5 ... 1..3 # pass 2 # fail 1 ``` -------------------------------- ### Pipe TAP Output to a Reporter Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Example of piping the raw TAP output from Fishtape to an external reporter like `tnyan` for enhanced visualization of test results. ```console $ fishtape test/* | tnyan ``` -------------------------------- ### Basic Fishtape Tests Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Define simple tests using the `@test` function with descriptions and assertions. These tests check for file existence, mathematical expressions, and user identity. ```fish @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 ``` -------------------------------- ### Compare Multiline Output with String Collect Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Test multiline output by collecting input into a single argument using `string collect`. This preserves newlines for accurate comparison. ```fish @test "one two three" (seq 3 | string collect) = "1 2 3" ``` -------------------------------- ### Compare Multiline Output with Echo Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Test multiline output by collapsing newlines using `echo`. This is useful for comparing expected and actual string values that span multiple lines. ```fish @test "first six evens" (echo (seq 2 2 12)) = "2 4 6 8 10 12" ``` -------------------------------- ### Print TAP Comments with @echo Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Use the `@echo` function to print comments to the TAP stream during test execution. It is equivalent to `echo "# $argv"`. ```fish @echo -- strings -- ``` -------------------------------- ### Test Command Exit Status Source: https://github.com/jorgebucaran/fishtape/blob/main/README.md Test the exit status of a command, such as `git diff-index`. Suppress stdout to avoid interfering with the test expression. ```fish @test "repo is clean" (git diff-index --quiet @) $status -eq 0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.