diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-03 16:46:46 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-03 16:46:46 +0900 |
| commit | 9c8d12237ad9e09be52da16d712f6997f98c8b26 (patch) | |
| tree | 54b8c3461ca21320aabfc603369bbc535968cb05 /tests | |
| parent | 9a4381b459f69d6fec4112c99c8e9c3e441a9c06 (diff) | |
| download | P4Dcc-9c8d12237ad9e09be52da16d712f6997f98c8b26.tar.gz P4Dcc-9c8d12237ad9e09be52da16d712f6997f98c8b26.tar.zst P4Dcc-9c8d12237ad9e09be52da16d712f6997f98c8b26.zip | |
local variables
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/007.sh | 9 | ||||
| -rw-r--r-- | tests/008.sh | 11 | ||||
| -rw-r--r-- | tests/test_exit_code.sh | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/007.sh b/tests/007.sh new file mode 100644 index 0000000..6f043b7 --- /dev/null +++ b/tests/007.sh @@ -0,0 +1,9 @@ +set -e + +bash ../../test_exit_code.sh 42 <<'EOF' +int main() { + int foo; + foo = 42; + return foo; +} +EOF diff --git a/tests/008.sh b/tests/008.sh new file mode 100644 index 0000000..94936cd --- /dev/null +++ b/tests/008.sh @@ -0,0 +1,11 @@ +set -e + +bash ../../test_exit_code.sh 70 <<'EOF' +int main() { + int foo; + int bar; + foo = 42; + bar = 28; + return foo + bar; +} +EOF diff --git a/tests/test_exit_code.sh b/tests/test_exit_code.sh index f69e862..ad548e4 100644 --- a/tests/test_exit_code.sh +++ b/tests/test_exit_code.sh @@ -12,6 +12,6 @@ exit_code=$? expected=$1 if [[ ! $exit_code -eq $expected ]]; then - echo "expected $expected, but $exit_code" >&2 + echo "invalid exit code: expected $expected, but got $exit_code" >&2 exit 1 fi |
