diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-05 07:19:00 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-05 07:19:00 -0700 |
commit | d654390f21bc0e37addd60646f85999f0dc99a6c (patch) | |
tree | fc2e4d2c50d006dd348e96f1454bbb982aa209c5 /tests/019 | |
parent | 6282ccbbd887acea149001c94f7c4deea02e7783 (diff) | |
download | txr-d654390f21bc0e37addd60646f85999f0dc99a6c.tar.gz txr-d654390f21bc0e37addd60646f85999f0dc99a6c.tar.bz2 txr-d654390f21bc0e37addd60646f85999f0dc99a6c.zip |
New functions load-args-recurse and load-args-process
* autoload.c (load_args_set_entries, load_args_instantiate):
New static functions.
(autoload_init): Register new auto-loaded module "load-args".
* stdlib/load-args.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/019')
-rw-r--r-- | tests/019/load-args.tl | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/019/load-args.tl b/tests/019/load-args.tl new file mode 100644 index 00000000..bd0037f1 --- /dev/null +++ b/tests/019/load-args.tl @@ -0,0 +1,72 @@ +(load "../common") + +(defvar *trace*) + +(defmacro deftrace (fun) + ^(defun ,fun (. args) + (push ^(,%fun% ,*args) *trace*))) + +(handle + (eval '(progn + (deftrace load) + (deftrace compile-update-file) + (deftrace clean-file))) + (warning (x . rest) + (throw 'continue))) + +(defmacro tr (form) + ^(let ((*trace* nil)) + ,form + (reverse *trace*))) + +(mtest + (tr (load-args-recurse '("abc"))) ((load "abc")) + (tr (load-args-recurse "abc")) ((load "abc")) + (tr (load-args-recurse "abc" "def")) ((load "abc") (load "def")) + (tr (load-args-recurse '("abc") "def")) ((load ("abc")) (load "def"))) + +(let ((*load-args* '(1 2))) + (mtest + (tr (load-args-recurse '("abc"))) ((load "abc" 1 2)) + (tr (load-args-recurse "abc")) ((load "abc" 1 2)) + (tr (load-args-recurse "abc" "def")) ((load "abc" 1 2) (load "def" 1 2)) + (tr (load-args-recurse '("abc") "def")) ((load ("abc") 1 2) (load "def" 1 2)))) + +(mtest + (tr (load-args-process '("abc"))) ((load "abc")) + (tr (load-args-process "abc")) ((load "abc")) + (tr (load-args-process "abc" "def")) ((load "abc") (load "def")) + (tr (load-args-process '("abc") "def")) ((load ("abc")) (load "def"))) + +(let ((*load-args* '(1 2))) + (mtest + (tr (load-args-process '("abc"))) ((load "abc" 1 2)) + (tr (load-args-process "abc")) ((load "abc" 1 2)) + (tr (load-args-process "abc" "def")) ((load "abc" 1 2) (load "def" 1 2)) + (tr (load-args-process '("abc") "def")) ((load ("abc") 1 2) (load "def" 1 2)))) + +(let ((*load-args* '(:compile))) + (mtest + (tr (load-args-process '("abc"))) ((compile-update-file "load-args.tl") + (compile-update-file "abc")) + (tr (load-args-process "abc")) ((compile-update-file "load-args.tl") + (compile-update-file "abc")) + (tr (load-args-process "abc" "def")) ((compile-update-file "load-args.tl") + (compile-update-file "abc") + (compile-update-file "def")) + (tr (load-args-process '("abc") "def")) ((compile-update-file "load-args.tl") + (compile-update-file ("abc")) + (compile-update-file "def")))) + +(let ((*load-args* '(:clean))) + (mtest + (tr (load-args-process '("abc"))) ((clean-file "load-args.tl") + (clean-file "abc")) + (tr (load-args-process "abc")) ((clean-file "load-args.tl") + (clean-file "abc")) + (tr (load-args-process "abc" "def")) ((clean-file "load-args.tl") + (clean-file "abc") + (clean-file "def")) + (tr (load-args-process '("abc") "def")) ((clean-file "load-args.tl") + (clean-file ("abc")) + (clean-file "def")))) |