| 1 |
;; |
| 2 |
;; Quick check for scripts. |
| 3 |
;; |
| 4 |
;; Run this as 'gosh check-script <script-file> ...' |
| 5 |
;; |
| 6 |
|
| 7 |
(use gauche.test) |
| 8 |
(use file.util) |
| 9 |
|
| 10 |
(define (main args) |
| 11 |
(if (null? (cdr args)) |
| 12 |
(usage) |
| 13 |
(begin |
| 14 |
(test-start "scripts") |
| 15 |
(dolist [f (cdr args)] |
| 16 |
;; Often, "." is not in *load-path* and relative pathname may be |
| 17 |
;; given without "./"... so we ensure relative path begins with "./". |
| 18 |
(let1 p (if (absolute-path? f) |
| 19 |
f |
| 20 |
($ build-path "." |
| 21 |
$ sys-normalize-pathname f :canonicalize #t)) |
| 22 |
(test-script p))) |
| 23 |
(test-end)))) |
| 24 |
|
| 25 |
(define (usage) |
| 26 |
(print "Usage: gosh check-script <script-file> ...") |
| 27 |
(print "Runs test-script function on each <script-file> to find out") |
| 28 |
(print "undefined functions, call procedures with wrong number of arguments, etc.") |
| 29 |
(exit 1)) |
| 30 |
|
| 31 |
;; Local variables: |
| 32 |
;; mode: scheme |
| 33 |
;; end: |