Skip to content

Commit 3e8ed0b

Browse files
committed
add test fpr quoted arguments
Signed-off-by: Evangelos Lamprou <vagos@lamprou.xyz>
1 parent 1f04771 commit 3e8ed0b

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

test/quoted_arguments.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
TRY_TOP="${TRY_TOP:-$(git rev-parse --show-toplevel --show-superproject-working-tree 2>/dev/null || echo "${0%/*}")}"
4+
TRY="$TRY_TOP/try"
5+
6+
cleanup() {
7+
cd /
8+
9+
if [ -d "$try_workspace" ]
10+
then
11+
rm -rf "$try_workspace" >/dev/null 2>&1
12+
fi
13+
14+
if [ -f "$expected" ]
15+
then
16+
rm "$expected"
17+
fi
18+
}
19+
20+
trap 'cleanup' EXIT
21+
22+
try_workspace="$(mktemp -d)"
23+
cd "$try_workspace" || exit 9
24+
25+
expected="$(mktemp)"
26+
cat >"$expected" <<'EOF'
27+
hello world
28+
it's ok
29+
EOF
30+
31+
arg1="hello world"
32+
arg2="it's ok"
33+
34+
"$TRY" printf '%s\n' "$arg1" "$arg2" >out.txt || exit 1
35+
36+
diff -q "$expected" out.txt

0 commit comments

Comments
 (0)