summaryrefslogtreecommitdiffstats
path: root/tests/000
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-01-30 23:11:47 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-01-30 23:11:47 -0800
commit7b26a8a95f544c04c20af9fdeac16624685a15b6 (patch)
tree9b86323c6f6323d914fa0e69a3624db9bd97bc7e /tests/000
parentfd30d22a593b3e5a07855db6473241a0c8ced99c (diff)
downloadtxr-7b26a8a95f544c04c20af9fdeac16624685a15b6.tar.gz
txr-7b26a8a95f544c04c20af9fdeac16624685a15b6.tar.bz2
txr-7b26a8a95f544c04c20af9fdeac16624685a15b6.zip
@(rebind): bugfix: don't clobber right side variable.
* Makefile (tst/tests/000/binding.ok): Pass -B to txr for this new test. * match.c (v_rebind): Fix gaping copy-and-paste bug here, which causes rebind to take on the behavior of local/forget; it takes all symbols that appear as its arguments from the environment and produces an environment in which they don't exist. What we want is to remove the left variables from the environment, and since that is a nested pattern, the right way to do that is to flatten it. Bug reported by Frank Schwidom. * tests/000/binding.txr: New file. * tests/000/binding.expected: New file. * txr.1: Improve documentation of @(rebind), also making improvements in @(set) documentation.
Diffstat (limited to 'tests/000')
-rw-r--r--tests/000/binding.expected6
-rw-r--r--tests/000/binding.txr5
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/000/binding.expected b/tests/000/binding.expected
new file mode 100644
index 00000000..9e5303f0
--- /dev/null
+++ b/tests/000/binding.expected
@@ -0,0 +1,6 @@
+x="1"
+y="2"
+z[0]="1"
+z[1]="2"
+a="1"
+b="0"
diff --git a/tests/000/binding.txr b/tests/000/binding.txr
new file mode 100644
index 00000000..95faa20d
--- /dev/null
+++ b/tests/000/binding.txr
@@ -0,0 +1,5 @@
+@(bind x 1)
+@(bind y 2)
+@(rebind z (x y))
+@(bind (a b) (0 1))
+@(rebind (a b) (b a))