aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorozan yigit <ozan.yigit@gmail.com>2023-12-28 14:51:49 -0500
committerozan yigit <ozan.yigit@gmail.com>2023-12-28 14:51:49 -0500
commit04f69eaf0b99d6c0ca65115973830218ba8a2b72 (patch)
tree458ba321063709a1502b8a6c2220463c5b658b88
parent08fa2b8c53138ee1162a2b9be78e192adcce26ec (diff)
downloadone-true-awk-04f69eaf0b99d6c0ca65115973830218ba8a2b72.tar.gz
test for matchop dereference bug
-rw-r--r--bugs-fixed/matchop-deref.awk11
-rw-r--r--bugs-fixed/matchop-deref.bad2
-rw-r--r--bugs-fixed/matchop-deref.in1
-rw-r--r--bugs-fixed/matchop-deref.ok2
4 files changed, 16 insertions, 0 deletions
diff --git a/bugs-fixed/matchop-deref.awk b/bugs-fixed/matchop-deref.awk
new file mode 100644
index 0000000..6c066aa
--- /dev/null
+++ b/bugs-fixed/matchop-deref.awk
@@ -0,0 +1,11 @@
+function foo() {
+ return "aaaaaab"
+}
+
+BEGIN {
+ print match(foo(), "b")
+}
+
+{
+ print match(substr($0, 1), "b")
+}
diff --git a/bugs-fixed/matchop-deref.bad b/bugs-fixed/matchop-deref.bad
new file mode 100644
index 0000000..343ee5c
--- /dev/null
+++ b/bugs-fixed/matchop-deref.bad
@@ -0,0 +1,2 @@
+-1
+-1
diff --git a/bugs-fixed/matchop-deref.in b/bugs-fixed/matchop-deref.in
new file mode 100644
index 0000000..0d197e1
--- /dev/null
+++ b/bugs-fixed/matchop-deref.in
@@ -0,0 +1 @@
+aaaaaab
diff --git a/bugs-fixed/matchop-deref.ok b/bugs-fixed/matchop-deref.ok
new file mode 100644
index 0000000..49019db
--- /dev/null
+++ b/bugs-fixed/matchop-deref.ok
@@ -0,0 +1,2 @@
+7
+7