1515
1616(defun write-tmp-file (fname send-lst)
1717 ` (with-open-file (test-file , fname :direction :output :if-exists :supersede )
18- (princ-line " (lisp::install-error-handler #'(lambda (&rest args) (exit 1)))" test-file)
18+ (princ-line " (defun exit-on-error (&rest args) (exit 1))" test-file)
19+ (princ-line " (lisp::install-error-handler 'exit-on-error)" test-file)
1920 (princ-line " (require :argparse \" lib/llib/argparse.l\" )" test-file)
2021 (terpri test-file)
2122 (princ-line " (setq argparse (instantiate argparse:argument-parser))" test-file)
4243 (resf (tmp " tmp-argparse-result-" name)))
4344 ` (deftest , name
4445 , (write-tmp-file testf send-lst)
45- (assert (= 0 (unix :system , (format nil " eus ~A ~A 2>/dev/null 1>~A " testf command resf))))
46+ (assert (= 0 (unix :system , (format nil " ~A ~A ~A 2>/dev/null 1>~A "
47+ *program-name* testf command resf))))
4648 (let ((alst (read-file , resf)))
4749 ,@ (mapcar #' (lambda (res)
4850 ` (assert (and (assoc , (car res) alst)
5456 (resf (tmp " tmp-argparse-result-" name)))
5557 ` (deftest , name
5658 , (write-tmp-file testf send-lst)
57- (assert (= 0 (unix :system , (format nil " eus ~A --help 2>/dev/null 1>~A " testf resf))))
59+ (assert (= 0 (unix :system , (format nil " ~A ~A --help 2>/dev/null 1>~A "
60+ *program-name* testf resf))))
5861 (let ((str1 , result)
5962 (str2 (string-right-trim ' (#\Space #\Newline ) (read-binary-file , resf))))
6063 (assert (string= str1 str2))))))
6366 (let ((testf (tmp " tmp-argparse-test-" name)))
6467 ` (deftest , name
6568 , (write-tmp-file testf send-lst)
66- (assert (= 256 (unix :system , (format nil " eus ~A ~A 2>/dev/null 1>/dev/null" testf command)))))))
69+ (assert (= 256 (unix :system , (format nil " ~A ~A ~A 2>/dev/null 1>/dev/null"
70+ *program-name* testf command)))))))
6771
6872
6973; ; HELP TESTS
@@ -336,7 +340,7 @@ optional arguments:
336340 (:add-argument " -cc" :help " Callback with compiled function"
337341 :action #' print )
338342 (:add-argument " -ccf" :help " Callback with compiled function"
339- :action #' lisp-implementation-version )
343+ :action #' lisp-implementation-type )
340344 (:add-argument " --count" :action :count )
341345 (:add-argument ' (" --append" " -a" ) :action :append :read t :choices (list 1 2 3 ))
342346 (:add-argument " --const" :const 10 :action :store-const ))
@@ -530,15 +534,15 @@ optional arguments:
530534 (:add-argument " -cc" :help " Callback with compiled function"
531535 :action #' print )
532536 (:add-argument " -ccf" :help " Callback with compiled function"
533- :action #' lisp-implementation-version )
537+ :action #' lisp-implementation-type )
534538 (:add-argument " --count" :action :count )
535539 (:add-argument ' (" --append" " -a" ) :action :append :read t :choices (list 1 2 3 ))
536540 (:add-argument " --const" :const 10 :action :store-const ))
537541
538542(defargparse-test parse-overall.2
539543 " --arg=a --req=3 --def=2 -ff --dest=b -ccf --count"
540544 ((:arg " a" ) (:req 3 ) (:def 2 ) (:remap " b" ) (:flag nil ) (:flag-false nil )
541- (:ca nil ) (:cf nil ) (:cc nil ) (:ccf #. (lisp-implementation-version )) (:count 1 )
545+ (:ca nil ) (:cf nil ) (:cc nil ) (:ccf #. (lisp-implementation-type )) (:count 1 )
542546 (:append nil ) (:const nil ))
543547 (:init :description " Program Description" :prog " test.l" )
544548 (:add-argument " --arg" :help " The 'arg' argument" :required t )
@@ -554,7 +558,7 @@ optional arguments:
554558 (:add-argument " -cc" :help " Callback with compiled function"
555559 :action #' print )
556560 (:add-argument " -ccf" :help " Callback with compiled function"
557- :action #' lisp-implementation-version )
561+ :action #' lisp-implementation-type )
558562 (:add-argument " --count" :action :count )
559563 (:add-argument ' (" --append" " -a" ) :action :append :read t :choices (list 1 2 3 ))
560564 (:add-argument " --const" :const 10 :action :store-const ))
0 commit comments