Skip to content

Commit

Permalink
Tweak some test (tree behavior change, and home testing) wrench:
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrieanKhisbe committed Jul 21, 2024
1 parent f0e5588 commit 8505224
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 7 additions & 14 deletions test/diraction_command_shpec.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,26 @@ DIRS
end

it "create working diractions using batch with tildes and quotes"
OLD_HOME="$HOME"
HOME="/tmp"
mkdir -p "$HOME/.test/d1" "$HOME/.test/d2" "$HOME/.test/d3" "$HOME/.test/with space"
diraction batch-create << "DIRS"
diraction batch-create --ignore-missing-dir option << "DIRS"
test1-home ~/.test/d1
test2-home-quote '~/.test/d2'
test3-home-double-quote "~/.test/d3"
test4-home-double-quote-comment "~/.test/with space" # comment
DIRS

assert glob "$(type test1-home)" "*alias*"
test1-home
assert equal "$PWD" "~/.test/d1"
assert equal "$(whence -f test1-home)" '_diraction-dispatch "~/.test/d1"'

assert glob "$(type test2-home-quote)" "*alias*"
test2-home-quote
assert equal "$PWD" "~/.test/d2"
assert equal "$(whence -f test2-home-quote)" '_diraction-dispatch "'"'"'~/.test/d2'"'"'"' # "'path'" in quotes

assert glob "$(type test3-home-double-quote-comment)" "*alias*"
test3-home-double-quote-comment
assert equal "$PWD" "~/.test/d3"
assert glob "$(type test3-home-double-quote)" "*alias*"
assert equal "$(whence -f test3-home-double-quote)" '_diraction-dispatch ""~/.test/d3""'

assert glob "$(type test4-home-double-quote-comment)" "*alias*"
test4-home-double-quote-comment
assert equal "$PWD" "~/.test/with space"
assert equal "$(whence -f test4-home-double-quote-comment)" '_diraction-dispatch ""~/.test/with space""'

diraction destroy-all -f
HOME="$OLD_HOME"
end

it "create working diractions using batch and option"
Expand Down
2 changes: 1 addition & 1 deletion test/diraction_dispatcher_shpec.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe "Dispacher Command"
it 'can tree files in it'
output=$(dir tree | sed 's/`/i/')
assert grep "$output" "/tmp/diraction-test"
assert grep "$output" "0 directories, 3 files"
assert grep "$output" "[01] director.*, 3 files" # pattern to support both macos/linus
assert equal "$(pwd)" $ORIGINAL_DIR
end

Expand Down

0 comments on commit 8505224

Please sign in to comment.