From 15c8a2f45b3916f840665b317afb344cbc08f5a4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 13 Aug 2025 01:14:35 +0900 Subject: feat: implement block-based variable scope --- tests/088.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/088.sh (limited to 'tests') diff --git a/tests/088.sh b/tests/088.sh new file mode 100644 index 0000000..6630cf0 --- /dev/null +++ b/tests/088.sh @@ -0,0 +1,35 @@ +set -e + +cat <<'EOF' > expected +0 +1 +2 +3 +4 +0 +1 +2 +3 +4 +43 +42 +EOF + +bash ../../test_diff.sh <<'EOF' +int printf(); + +int main() { + for (int i = 0; i < 5; i++) { + printf("%d\n", i); + } + for (int i = 0; i < 5; i++) { + printf("%d\n", i); + } + int x = 42; + { + int x = 43; + printf("%d\n", x); + } + printf("%d\n", x); +} +EOF -- cgit v1.2.3-70-g09d2