split helpers into files
1 file changed, 8 insertions(+), 4 deletions(-)
changed files
M tests/scriptura.fish → tests/scriptura.fish
@@ -4,6 +4,7 @@ # Setup test environment set --global test_root (mktemp -d) set --global original_scriptura_root $SCRIPTURA_ROOT set --global original_sd_root $SD_ROOT +set --prepend fish_function_path (status dirname)/../functions # Helper function to clean up function cleanup@@ -24,6 +25,7 @@ # Test: SCRIPTURA_ROOT defaults to ~/sd when not set @test "SCRIPTURA_ROOT defaults to ~/sd when not set" ( set --erase SCRIPTURA_ROOT set --erase SD_ROOT + source $(status dirname)/../conf.d/scriptura-config.fish source $(status dirname)/../functions/scriptura.fish scriptura ) = "\$SCRIPTURA_ROOT $HOME/sd does not exist, use `scriptura --new` to create it"@@ -32,6 +34,7 @@ # Test: SCRIPTURA_ROOT uses SD_ROOT when set @test "SCRIPTURA_ROOT uses SD_ROOT when set" ( set --erase SCRIPTURA_ROOT set --global --export SD_ROOT "/custom/sd" + source $(status dirname)/../conf.d/scriptura-config.fish source $(status dirname)/../functions/scriptura.fish scriptura ) = "\$SCRIPTURA_ROOT /custom/sd does not exist, use `scriptura --new` to create it"@@ -40,6 +43,7 @@ # Test: SCRIPTURA_ROOT uses existing value when set @test "SCRIPTURA_ROOT uses existing value when set" ( set --global --export SCRIPTURA_ROOT "/existing/root" set --global --export SD_ROOT "/custom/sd" + source $(status dirname)/../conf.d/scriptura-config.fish source $(status dirname)/../functions/scriptura.fish scriptura ) = "\$SCRIPTURA_ROOT /existing/root does not exist, use `scriptura --new` to create it"@@ -195,7 +199,7 @@ set --global --export SCRIPTURA_ROOT $test_root mkdir -p "$test_root/dash_test" printf "#!/usr/bin/env fish\necho dash_dir\n" > "$test_root/dash_test/script" chmod +x "$test_root/dash_test/script" - scriptura dash_test -- script 2>&1 | string match --regex "^script\s+ --" + scriptura dash_test -- script 2>&1 | string match "script*" ) # Test: SCRIPTURA_CAT is used when set@@ -216,10 +220,10 @@ scriptura --cat sd_cat_test ) = line1 # Test: unknown target shows error -@test "unknown target shows error" -n "$( +@test "unknown target shows error" "$( set --global --export SCRIPTURA_ROOT $test_root - scriptura nonexistent_target 2>&1 | string match --regex "don't know what to do" -)" + scriptura nonexistent_target 2>&1 +)" = 'scriptura: don\'t know what to do with target "nonexistent_target"' # Test: help for directory without help file shows default @test "help for directory without help file shows default" (