added more test code

This commit is contained in:
hyung-hwan 2022-05-05 13:04:04 +00:00
parent ff089929a9
commit 0725bfe27a
4 changed files with 31 additions and 3 deletions

View File

@ -12,6 +12,7 @@ A HCL program is composed of expressions.
## Special Form Expression
* and
* break
* defclass
* defun
* do
* elif

View File

@ -4,7 +4,7 @@ check_SCRIPTS = \
insta-01.hcl \
insta-02.hcl \
ret-01.hcl \
retvar-01.hcl
retvar-01.hcl \
var-01.hcl
##noinst_SCRIPTS = $(check_SCRIPTS)

View File

@ -465,7 +465,8 @@ check_SCRIPTS = \
insta-01.hcl \
insta-02.hcl \
ret-01.hcl \
retvar-01.hcl
retvar-01.hcl \
var-01.hcl
EXTRA_DIST = $(check_SCRIPTS)
TEST_EXTENSIONS = .hcl
@ -838,7 +839,6 @@ uninstall-am:
.PRECIOUS: Makefile
var-01.hcl
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -63,3 +63,30 @@
)
(x)
(defclass T
| j |
(defun ::* new()
(set j 99)
(return self)
)
(defun x()
(do
| x |
(set x 1)
(while (< x j)
(defun Q() x)
(set x (+ x 1))
)
}
)
)
(set t (:T new))
(:t x)
(set t (Q))
(if (/= t 99) (print "ERROR: t is not 99\n")
else (printf "OK: %d\n" t))