Skip to content

Commit

Permalink
Merge pull request #3085 from ipfs/fix-test_fsh
Browse files Browse the repository at this point in the history
ipfs-test-lib: fix test_fsh arg quoting
  • Loading branch information
whyrusleeping committed Aug 16, 2016
2 parents 685cd28 + 2489dfe commit 4eb7c6c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/ipfs-test-lib.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Generic test functions for go-ipfs

# Quote arguments for sh eval
shellquote() {
_space=''
for _arg
do
# On Mac OS, sed adds a newline character.
# With a printf wrapper the extra newline is removed.
printf "$_space'%s'" "$(printf "%s" "$_arg" | sed -e "s/'/'\\\\''/g;")"
_space=' '
done
printf '\n'
}

# Echo the args, run the cmd, and then also fail,
# making sure a test case fails.
test_fsh() {
echo "> $@"
eval "$@"
eval $(shellquote "$@")
echo ""
false
}
Expand All @@ -31,19 +44,6 @@ test_path_cmp() {
test_cmp "$1_std" "$2_std"
}

# Quote arguments for sh eval
shellquote() {
_space=''
for _arg
do
# On Mac OS, sed adds a newline character.
# With a printf wrapper the extra newline is removed.
printf "$_space'%s'" "$(printf "%s" "$_arg" | sed -e "s/'/'\\\\''/g;")"
_space=' '
done
printf '\n'
}

# Docker

# This takes a Dockerfile, and a build context directory
Expand Down

0 comments on commit 4eb7c6c

Please sign in to comment.