Skip to content
This repository was archived by the owner on May 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fasd
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ fasd [-A|-D] [paths ...]

local res
res="$(fasd --query 2>> "$_FASD_SINK")" # query the database
[ $? -gt 0 ] && return
exitCode=$?
[ $exitCode -gt 0 ] && return $exitCode
if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then
res="$(printf %s\\n "$res" | sort -n${R} | \
sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')"
Expand Down
23 changes: 23 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/zsh

fasd -f notARealFile.txt
failed=$?
fasd -f .vimrc
success=$?
fasd -d ~
success_cd=$?

if [[ $failed == 1 ]]; then
if [[ $success == 0 ]]; then
if [[ $success_cd == 0 ]]; then
echo Tests passed!
else
echo Error: ~ should have been found!
fi
else
echo Error: .vimrc should have been found!
fi
else
echo Error: notARealFile.txt should not have been found!
fi