diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-12 06:46:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-12 06:46:42 -0700 |
commit | 3905cde43431cc4edcf901931f7b46511c21e6d8 (patch) | |
tree | df3364342ec8488acea1ad37a3a07a302a4d6b3c | |
parent | c176b812d68da2284a221c8533a68a1aa290960b (diff) | |
download | egawk-3905cde43431cc4edcf901931f7b46511c21e6d8.tar.gz egawk-3905cde43431cc4edcf901931f7b46511c21e6d8.tar.bz2 egawk-3905cde43431cc4edcf901931f7b46511c21e6d8.zip |
@let: additional tests of variable clearing.
* test/let1.awk: Test cases covering more kinds of loops.
-rw-r--r-- | test/let1.awk | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/let1.awk b/test/let1.awk index 90b1248b..a67e3639 100644 --- a/test/let1.awk +++ b/test/let1.awk @@ -86,3 +86,60 @@ BEGIN { } } } + +BEGIN { + @let (i = 0) while (i++ < 2) { + @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 { + @let (i = 0) do { + @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 + } + } while (++i < 2) +} + +BEGIN { + @let (a, i) { + a[0] = 42 + for (i in a) { + @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 { + @let (a = 1, b = 1, c = 1) { } + @let (a, b, c) { + if (a != 0 || a != "") + exit 1 + if (b != 0 || b != "") + exit 1 + if (c != 0 || c != "") + exit 1 + } +} |