From 0725bfe27a1e379b12293b44e7acce0f26d051e2 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 5 May 2022 13:04:04 +0000 Subject: [PATCH] added more test code --- README.md | 1 + t/Makefile.am | 2 +- t/Makefile.in | 4 ++-- t/var-01.hcl | 27 +++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd35101..700cba0 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ A HCL program is composed of expressions. ## Special Form Expression * and * break +* defclass * defun * do * elif diff --git a/t/Makefile.am b/t/Makefile.am index dab2318..1a6e0d7 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -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) diff --git a/t/Makefile.in b/t/Makefile.in index 97de598..8c4d855 100644 --- a/t/Makefile.in +++ b/t/Makefile.in @@ -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. diff --git a/t/var-01.hcl b/t/var-01.hcl index ed88543..a9eef84 100644 --- a/t/var-01.hcl +++ b/t/var-01.hcl @@ -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))