aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/let1.awk33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/let1.awk b/test/let1.awk
index c7e98468..94a1a681 100644
--- a/test/let1.awk
+++ b/test/let1.awk
@@ -37,3 +37,36 @@ BEGIN {
@let (x = x + 1, x = x + 1)
print "b3", l3 "-" x
}
+
+# test clearing uninitialized variables
+
+function f4()
+{
+ @let (i) for (i = 0; i < 2; i++) {
+ @let (a, b, c) {
+ if (a != 0 || a != "")
+ exit 1
+ if (b != 0 || b != "")
+ exit 1
+ if (c != 0 || c != "")
+ exit 1
+ a = b = c = 1
+ }
+ }
+}
+
+BEGIN { f4() }
+
+BEGIN {
+ @let (i) for (i = 0; i < 2; i++) {
+ @let (a, b, c) {
+ if (a != 0 || a != "")
+ exit 1
+ if (b != 0 || b != "")
+ exit 1
+ if (c != 0 || c != "")
+ exit 1
+ a = b = c = 1
+ }
+ }
+}