diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-12 22:45:25 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-12 22:45:25 +0300 |
commit | 28daef44c3c08f16002c678319a30b816f6972fd (patch) | |
tree | 5bb3ed751db1d4c32b71a72e2fc87c52e1f46de9 /test/assignconst.awk | |
parent | 4319d9141a56cb8ed878d44d0e74bedee51085a6 (diff) | |
download | egawk-28daef44c3c08f16002c678319a30b816f6972fd.tar.gz egawk-28daef44c3c08f16002c678319a30b816f6972fd.tar.bz2 egawk-28daef44c3c08f16002c678319a30b816f6972fd.zip |
Allow creation of constants from extensions.
Diffstat (limited to 'test/assignconst.awk')
-rw-r--r-- | test/assignconst.awk | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/assignconst.awk b/test/assignconst.awk new file mode 100644 index 00000000..907987c7 --- /dev/null +++ b/test/assignconst.awk @@ -0,0 +1,58 @@ +@load "testext" + +BEGIN { + print "" + print "test:", ARGV[1] + switch (ARGV[1] + 0) { + case 1: + answer_num = 43 + break + case 2: + ++answer_num + break + case 3: + --answer_num + break + case 4: + answer_num++ + break + case 5: + answer_num-- + break + case 6: + answer_num += 1 + break + case 7: + answer_num -= 1 + break + case 8: + answer_num *= 1 + break + case 9: + answer_num /= 1 + break + case 10: + answer_num ^= 1 + break + case 11: + answer_num = answer_num "foo" + break + case 12: + sub(/2/, "3", answer_num) + break + case 13: + a[1] = 1 + for (answer_num in a) + print answer_num, a[answer_num] + break + case 14: + test_func(answer_num) + break + } +} + +function test_func(val) +{ + val++ + print "in test_func, val now =", val +} |