Skip to content

Commit

Permalink
Merge pull request #175 from psliwka/psliwka/fix-homeshick.fish
Browse files Browse the repository at this point in the history
Fix argument testing in homeshick.fish
  • Loading branch information
andsens authored Feb 23, 2018
2 parents 680252e + 83b05a7 commit 0bebb26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion homeshick.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# "homeshick cd CASTLE" to enter a castle.

function homeshick
if test \( (count $argv) = 2 -a $argv[1] = "cd" \)
if test \( (count $argv) = 2 -a "$argv[1]" = "cd" \)
cd "$HOME/.homesick/repos/$argv[2]"
else if set -q HOMESHICK_DIR
eval $HOMESHICK_DIR/bin/homeshick (string escape -- $argv)
Expand Down
8 changes: 8 additions & 0 deletions test/suites/misc.bats
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ load ../helper
run grep -q 'nn$' <<<"$output"
[ $status -eq 1 ]
}

@test 'fish function should not print errors when invoked without arguments' {
[ "$(type -t fish)" = "file" ] || skip "fish not installed"
cmd="source "$HOMESHICK_FN_SRC_FISH"; and $HOMESHICK_FN"
local stderr
stderr=$( fish <<< "$cmd" 2>&1 >/dev/null )
[ -z "$stderr" ]
}

0 comments on commit 0bebb26

Please sign in to comment.