aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDelilah Hoare <delilah@dhoare.me>2022-03-06 20:21:40 +1100
committerCole Faust <colecfaust@gmail.com>2022-11-28 12:42:27 -0800
commita4f36671fe86d5f535a26047f275b5f356c5e6e6 (patch)
tree2f5466180f16898b5e398b3caeec1d810efe9742
parent9aaf4c5adba36d65d63666e0a5ddd1e736d72e5c (diff)
downloadkati-a4f36671fe86d5f535a26047f275b5f356c5e6e6.tar.gz
Add test case for $?
-rwxr-xr-xtestcase/question.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/testcase/question.sh b/testcase/question.sh
new file mode 100755
index 0000000..0d3c7c4
--- /dev/null
+++ b/testcase/question.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Copyright 2022 Google Inc. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+mk="$@"
+
+cat <<EOF > Makefile
+
+all: d
+
+a:
+ echo a > a
+
+b:
+ echo b > b
+
+c:
+ echo c > c
+
+d: a b c
+ echo \$? > d
+
+EOF
+
+${mk}
+cat d
+sleep 0.1
+touch b
+${mk}
+cat d
+