summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-07-08 22:04:44 +0000
committerjilles <jilles@FreeBSD.org>2014-07-08 22:04:44 +0000
commit26d6f0488543168ab53e731b626612a7d1028552 (patch)
tree8c8bd75929e6020dd037ad894eaa6a1d5e3d51ba /bin
parentb74f97a13b172cbc9cfe536514c5393abe0a3be1 (diff)
downloadFreeBSD-src-26d6f0488543168ab53e731b626612a7d1028552.zip
FreeBSD-src-26d6f0488543168ab53e731b626612a7d1028552.tar.gz
sh: Add test for ${01} and ${010} that already works.
Although it is probably unwise to use this, POSIX is clear that leading zeroes are permitted in positional parameters (and do not indicate octal). Such positional parameters are checked for being unset and/or null correctly, but their value is incorrectly expanded.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/tests/parameters/Makefile1
-rw-r--r--bin/sh/tests/parameters/positional3.04
2 files changed, 5 insertions, 0 deletions
diff --git a/bin/sh/tests/parameters/Makefile b/bin/sh/tests/parameters/Makefile
index fafc059..4f9ae31 100644
--- a/bin/sh/tests/parameters/Makefile
+++ b/bin/sh/tests/parameters/Makefile
@@ -13,6 +13,7 @@ FILES+= optind1.0
FILES+= optind2.0
FILES+= positional1.0
FILES+= positional2.0
+FILES+= positional3.0
FILES+= pwd1.0
FILES+= pwd2.0
diff --git a/bin/sh/tests/parameters/positional3.0 b/bin/sh/tests/parameters/positional3.0
new file mode 100644
index 0000000..1200469
--- /dev/null
+++ b/bin/sh/tests/parameters/positional3.0
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b)
+[ "$r" = yesyes ]
OpenPOWER on IntegriCloud