]> git.saurik.com Git - apple/shell_cmds.git/blobdiff - sh/tests/builtins/exec2.0
shell_cmds-198.tar.gz
[apple/shell_cmds.git] / sh / tests / builtins / exec2.0
diff --git a/sh/tests/builtins/exec2.0 b/sh/tests/builtins/exec2.0
new file mode 100644 (file)
index 0000000..3dcb6c4
--- /dev/null
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+failures=
+failure() {
+       echo "Error at line $1" >&2
+       failures=x$failures
+}
+
+(
+       exec -- >/dev/null
+       echo bad
+)
+[ $? = 0 ] || failure $LINENO
+(
+       exec -- ${SH} -c 'exit 42'
+       echo bad
+)
+[ $? = 42 ] || failure $LINENO
+(
+       exec -- /var/empty/nosuch
+       echo bad
+) 2>/dev/null
+[ $? = 127 ] || failure $LINENO
+
+test -z "$failures"