Files

17 lines
477 B
Scheme

(define-module (tests support)
#:use-module (ice-9 match)
#:use-module (srfi srfi-13)
#:export (run-tests-when-script))
(define (script-invocation? argv file-name)
(match argv
((program . _)
(and (string? program)
(or (string=? program file-name)
(string-suffix? (string-append "/" file-name) program))))
(_ #f)))
(define (run-tests-when-script file-name thunk)
(when (script-invocation? (command-line) file-name)
(thunk)))