updated multiple test files
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-01-03 00:45:34 +09:00
parent 309442e307
commit 758d5e953b
4 changed files with 57 additions and 61 deletions

View File

@ -1,35 +1,35 @@
(defun repeat(n f)
(while (> n 0)
(f)
(set n (- n 1))
)
)
defun repeat(n f) {
while (> n 0) {
f;
set n (- n 1);
};
};
(defun test-non-local-ret-1(k)
(repeat 10 (lambda()
(set k (+ k 2))
(if (= k 28) (return-from-home k))
))
defun test-non-local-ret-1(k) {
repeat 10 (fun() {
set k (+ k 2);
if (= k 28) { return-from-home k };
});
(return k)
)
return k;
};
(set a (test-non-local-ret-1 20))
(if (/= a 28) (printf "ERROR: a must be 28\n"))
(printf "OK %d\n" a)
set a (test-non-local-ret-1 20);
if (/= a 28) { printf "ERROR: a must be 28\n" }
else { (printf "OK %d\n" a) };
(set a (test-non-local-ret-1 21))
(if (/= a 41) (printf "ERROR: a must be 41\n"))
(printf "OK %d\n" a)
set a (test-non-local-ret-1 21);
if (/= a 41) { printf "ERROR: a must be 41\n" }
else { printf "OK %d\n" a };
(defun ff() (return 999))
defun ff() { return 999 };
## test a normal block return
(set a (ff))
(if (/= a 999) (printf "ERROR: a must be 999\n"))
(printf "OK %d\n" a)
set a (ff);
if (/= a 999) { printf "ERROR: a must be 999\n" }
else { printf "OK %d\n" a };
## return from top-level
(return 10)
(printf "ERROR: this line must not be printed\n")
return 10;
printf "ERROR: this line must not be printed\n";