aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-05-11 19:06:03 +0900
committernsfisis <nsfisis@gmail.com>2025-05-11 19:06:03 +0900
commit4e90e06cdb497a9099da619dc5728306f9a7c019 (patch)
treec3cfb54c1e86e02fd63db80ddc128febfb815a40
parent3b0f4c321ac99de44c09275dda74f6bfb7e59e05 (diff)
downloadducc-4e90e06cdb497a9099da619dc5728306f9a7c019.tar.gz
ducc-4e90e06cdb497a9099da619dc5728306f9a7c019.tar.zst
ducc-4e90e06cdb497a9099da619dc5728306f9a7c019.zip
add test for argc/argv
-rw-r--r--tests/048.sh20
-rw-r--r--tests/test_diff.sh2
2 files changed, 21 insertions, 1 deletions
diff --git a/tests/048.sh b/tests/048.sh
new file mode 100644
index 0000000..76b500f
--- /dev/null
+++ b/tests/048.sh
@@ -0,0 +1,20 @@
+set -e
+
+cat <<'EOF' > expected
+argc = 4
+argv[1] = hoge
+argv[2] = piyo
+argv[3] = fuga
+EOF
+bash ../../test_diff.sh hoge piyo fuga<<'EOF'
+int printf();
+
+int main(int argc, char** argv) {
+ printf("argc = %d\n", argc);
+ int i;
+ for (i = 1; i < argc; ++i) {
+ printf("argv[%d] = %s\n", i, argv[i]);
+ }
+ return 0;
+}
+EOF
diff --git a/tests/test_diff.sh b/tests/test_diff.sh
index ec0f1d0..8e938de 100644
--- a/tests/test_diff.sh
+++ b/tests/test_diff.sh
@@ -9,7 +9,7 @@ gcc -Wl,-z,noexecstack -o a.out main.s
if [[ ! -f input ]]; then
touch input
fi
-./a.out < input > output
+./a.out "$@" < input > output
exit_code=$?
if [[ $exit_code -ne 0 ]]; then