fix `--new` failing when creating a directory
2 files changed, 10 insertions(+), 1 deletion(-)
changed files
M functions/__scriptura_new.fish → functions/__scriptura_new.fish
@@ -2,7 +2,7 @@ function __scriptura_new --argument-names target set --function remaining $argv[2..-1] if not path is --type dir (path dirname $target) - mkdir -p $target + mkdir -p (path dirname $target) end if path is --type file $target
M tests/scriptura.fish → tests/scriptura.fish
@@ -84,6 +84,15 @@ scriptura --new shebang_test head -n 1 "$test_root/shebang_test" ) = "#!/usr/bin/env fish" +# Test: --new creates component directories +@test "--new creates component directories" ( + set --global --export SCRIPTURA_ROOT $test_root + set --global --export SCRIPTURA_EDITOR "touch" + scriptura --new foo bar baz + path is --type dir "$test_root/foo/bar" + path is --type file --perm exec "$test_root/foo/bar/baz" +) $status -eq 0 + # Test: --new fails if script already exists @test "--new fails if script already exists" -n ( set --global --export SCRIPTURA_ROOT $test_root