Permalink
Browse files

Add more encode_args tests

  • Loading branch information...
bdrewery committed Jan 4, 2018
1 parent 429514e commit 0d51a20abe276a828ef569b4cff37a533d6718bf
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/encode_args.sh
View
@@ -84,3 +84,22 @@ assert "1" "$1" "decode 3 trailing arguments x argument 1"
assert "" "$2" "decode 3 trailing arguments x argument 2"
assert "" "$3" "decode 3 trailing arguments x argument 3"
assert "x" "$4" "decode 3 trailing arguments x argument 4"
# Test parsing safety
# $()
tmpfile=$(mktemp -ut poudriere_encode_args)
encode_args data "\$(touch ${tmpfile})"
[ -f "${tmpfile}" ]
assert_not 0 $? "File should not exist when encoded"
eval $(decode_args data)
[ -f "${tmpfile}" ]
assert_not 0 $? "File should not exist when decoded"
# ``
tmpfile=$(mktemp -ut poudriere_encode_args)
encode_args data "\`touch ${tmpfile}\`"
[ -f "${tmpfile}" ]
assert_not 0 $? "File should not exist when encoded"
[ -f "${tmpfile}" ]
assert_not 0 $? "File should not exist when decoded"

0 comments on commit 0d51a20

Please sign in to comment.