summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-10 07:15:09 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-10 07:15:09 -0800
commite0814736ec16ca7712609b96558e4102883dda2a (patch)
tree7385715b480fa6ec4a1d6c099f6845de2da81a7e /tests
parent1e4eadfd30f675f80e17e84682dfc88da6be9681 (diff)
downloadtxr-e0814736ec16ca7712609b96558e4102883dda2a.tar.gz
txr-e0814736ec16ca7712609b96558e4102883dda2a.tar.bz2
txr-e0814736ec16ca7712609b96558e4102883dda2a.zip
define-accessor: fix broken arg handling.
I discovered this off chance by searching for occurrences of (let ,(zip ...) ...) or (let (,*(zip ...)) ...) in the code base, noticing an incorrect one. * stdlib/place.tl (sys:register-simple-accessor): Remove spurious list around ,(zip temps args). * tests/012/defset.tl: Test cases for define-accessor added.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/defset.tl12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/012/defset.tl b/tests/012/defset.tl
index 110f3c64..917c0a9c 100644
--- a/tests/012/defset.tl
+++ b/tests/012/defset.tl
@@ -19,3 +19,15 @@
(expand '(inc (foo 1 2 :a 3 :b 4) 5))
^(let ((,%new-val-sym% (+ (foo 1 2 :a 3 :b 4) 5)))
(bar 1 2 3 4 () 4 ,%new-val-sym%)))
+
+(defvarl %data% (vec 0 0 0 0 0 0 0 0 0 1))
+(defun getd (a b c) [%data% (+ a b c)])
+(defun setd (a b c v) (set [%data% (+ a b c)] v))
+(define-accessor getd setd)
+
+(mtest
+ (getd 2 3 4) 1
+ (set (getd 2 3 4) 2) 2
+ [%data% 9] 2
+ (inc (getd 2 3 4) 3) 5
+ [%data% 9] 5)