aboutsummaryrefslogtreecommitdiffstats
path: root/bugs-fixed
diff options
context:
space:
mode:
authorCody Peter Mello <melloc@writev.io>2018-09-15 01:38:39 -0700
committerCody Peter Mello <melloc@writev.io>2018-09-15 01:43:21 -0700
commite26237434fb769d9c1ea239101eb5b24be588eea (patch)
tree20ade6ab596df62844ba6b4a59d169a4eecd0ab3 /bugs-fixed
parent2dc7e5ff1a4feeeb549f32706cf34e17aba89192 (diff)
downloadplatform_external_one-true-awk-e26237434fb769d9c1ea239101eb5b24be588eea.tar.gz
platform_external_one-true-awk-e26237434fb769d9c1ea239101eb5b24be588eea.tar.bz2
platform_external_one-true-awk-e26237434fb769d9c1ea239101eb5b24be588eea.zip
Fix issues with assigning during concatenation
Diffstat (limited to 'bugs-fixed')
-rw-r--r--bugs-fixed/README5
-rw-r--r--bugs-fixed/concat-assign-same.awk4
-rw-r--r--bugs-fixed/concat-assign-same.bad2
-rw-r--r--bugs-fixed/concat-assign-same.ok2
4 files changed, 13 insertions, 0 deletions
diff --git a/bugs-fixed/README b/bugs-fixed/README
index 222ef68..7bdae04 100644
--- a/bugs-fixed/README
+++ b/bugs-fixed/README
@@ -23,3 +23,8 @@ and also if CONVFMT changed.
7. unary-plus: Unary plus on a string constant returned the string.
Instead, it should convert the value to numeric and give that value.
+
+X. concat-assign-same: Concatenation previously evaluated both sides of the
+expression before doing its work, which, since assign() evaluates to the cell
+being assigned to, meant that expressions like "print (a = 1) (a = 2)" would
+print "22" rather than "12".
diff --git a/bugs-fixed/concat-assign-same.awk b/bugs-fixed/concat-assign-same.awk
new file mode 100644
index 0000000..ed19f35
--- /dev/null
+++ b/bugs-fixed/concat-assign-same.awk
@@ -0,0 +1,4 @@
+BEGIN {
+ print (a = 1) (a = 2) (a = 3) (a = 4) (a = 5);
+ print (a = 1), (a = 2), (a = 3), (a = 4), (a = 5);
+}
diff --git a/bugs-fixed/concat-assign-same.bad b/bugs-fixed/concat-assign-same.bad
new file mode 100644
index 0000000..294725b
--- /dev/null
+++ b/bugs-fixed/concat-assign-same.bad
@@ -0,0 +1,2 @@
+22345
+1 2 3 4 5
diff --git a/bugs-fixed/concat-assign-same.ok b/bugs-fixed/concat-assign-same.ok
new file mode 100644
index 0000000..4475052
--- /dev/null
+++ b/bugs-fixed/concat-assign-same.ok
@@ -0,0 +1,2 @@
+12345
+1 2 3 4 5