summaryrefslogtreecommitdiffstats
path: root/contrib/awk/test/gsubasgn.awk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/awk/test/gsubasgn.awk')
-rw-r--r--contrib/awk/test/gsubasgn.awk13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/awk/test/gsubasgn.awk b/contrib/awk/test/gsubasgn.awk
new file mode 100644
index 0000000..f0b7701
--- /dev/null
+++ b/contrib/awk/test/gsubasgn.awk
@@ -0,0 +1,13 @@
+# tests for assigning to a function within that function
+
+#1 - should be bad
+function test1 (r) { gsub(r, "x", test1) }
+BEGIN { test1("") }
+
+#2 - should be bad
+function test2 () { gsub(/a/, "x", test2) }
+BEGIN { test2() }
+
+#3 - should be ok
+function test3 (r) { gsub(/a/, "x", r) }
+BEGIN { test3("") }
OpenPOWER on IntegriCloud