summaryrefslogtreecommitdiffstats
path: root/tests/012/defset.tl
blob: 110f3c644d6b311d70410656a4404982ac85c5d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(load "../common")

(defset foo (:key x y -- a b c (d 4)) n ^(bar ,x ,y, a, b, c ,d ,n))

;; obtain identity of new-val gensym: this is baked into defset
(defvarl %new-val-sym% (caar (last (cadr (expand '(inc (foo 1 2)))))))

(test
  (and (symbolp %new-val-sym%)
       (null (symbol-package %new-val-sym%))
       (starts-with "g" (symbol-name %new-val-sym%)))
  t)

(test
  (expand '(set (foo 1 2 :a 3 :b 4) 5))
  (bar 1 2 3 4 nil 4 5))

(vtest
  (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%)))