Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs-test-lib: fix test_fsh arg quoting #3085

Merged
merged 1 commit into from
Aug 16, 2016
Merged
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
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