aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_local_variables.sh
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-27 08:28:37 +0900
committernsfisis <nsfisis@gmail.com>2025-09-27 09:07:20 +0900
commit1c270ba5e27f126a251b5591cfac4243ba3c75f7 (patch)
tree8d13499752aefeb598d8a51ce22975d0031296db /tests/test_local_variables.sh
parentedb1612b9f5d5485528e24470b88a7d602772ad6 (diff)
downloadducc-1c270ba5e27f126a251b5591cfac4243ba3c75f7.tar.gz
ducc-1c270ba5e27f126a251b5591cfac4243ba3c75f7.tar.zst
ducc-1c270ba5e27f126a251b5591cfac4243ba3c75f7.zip
feat: allow variable initializer to access previously declared variables
Diffstat (limited to 'tests/test_local_variables.sh')
-rw-r--r--tests/test_local_variables.sh14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/test_local_variables.sh b/tests/test_local_variables.sh
index dfa704b..674899d 100644
--- a/tests/test_local_variables.sh
+++ b/tests/test_local_variables.sh
@@ -44,15 +44,13 @@ int main() {
}
EOF
-cat <<'EOF' > expected
-42
-EOF
-test_diff <<'EOF'
-int printf();
+test_exit_code 0 <<'EOF'
+#include "../../helpers.h"
int main() {
- int a = 42;
- printf("%d\n", a);
- return 0;
+ int d = 2, e = d, f = d + e;
+ ASSERT_EQ(2, d);
+ ASSERT_EQ(2, e);
+ ASSERT_EQ(4, f);
}
EOF