Skip to content

Commit 3be72c6

Browse files
committed
Fix test for COMPILE-BUILT-IN-APPLY function in Lisp backend.
1 parent 2b0bef7 commit 3be72c6

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

t/lang/compiler/lisp/compile.lisp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,37 @@
109109
"Base type - multiple bindings."))))
110110

111111

112-
(subtest "Built-in function application"
112+
;;
113+
;; COMPILE-BUILT-IN-APPLY
114+
115+
(eval-when (:compile-toplevel :load-toplevel :execute)
116+
(setf (fdefinition 'compile-built-in-apply)
117+
#'avm.lang.compiler.lisp.compile::compile-built-in-apply))
118+
119+
(subtest "compile-built-in-apply"
120+
121+
(with-env (tenv aenv fenv venv)
122+
(let ((aenv1 (extend-appenv '#1=(+ 1 1) '(int int int) aenv)))
123+
(is (compile-built-in-apply '#1# venv tenv aenv1 fenv)
124+
'(the fixnum (+ 1 1))
125+
"Base case - int addition.")))
113126

114127
(with-env (tenv aenv fenv venv)
115-
(let ((aenv1 (extend-appenv '#1=(coerce 1) '(int double) aenv)))
116-
(is (compile-form '#1# venv tenv aenv1 fenv)
128+
(let ((aenv1 (extend-appenv '#2=(coerce 1) '(int double) aenv)))
129+
(is (compile-built-in-apply '#2# venv tenv aenv1 fenv)
117130
'(the double-float (avm.lang.compiler.lisp.built-in::int->double 1))
118-
"Ok.")))
131+
"Base case - COERCE of int to double.")))
119132

120133
(with-env (tenv aenv fenv venv)
121-
(is-error (compile-form '(coerce 1) venv tenv aenv fenv)
134+
(is-error (compile-built-in-apply '(+ 1 1) venv tenv aenv fenv)
122135
simple-error
123136
"Not exist in appenv."))
124137

125138
(with-env (tenv aenv fenv venv)
126-
(let ((aenv1 (extend-appenv '#2=(+ 1 1 1) '(int int int) aenv)))
127-
(is-error (compile-form '#2# venv tenv aenv1 fenv)
139+
(let ((aenv1 (extend-appenv '#3=(+ 1 1 1) '(int int int) aenv)))
140+
(is-error (compile-built-in-apply '#3# venv tenv aenv1 fenv)
128141
simple-error
129-
"Invalid number of arguments.")))
130-
)
142+
"Invalid number of arguments."))))
131143

132144

133145
(finalize)

0 commit comments

Comments
 (0)