~ chicken-core (master) /tests/executable-tests.scm


 1;;; Compiled executable tests
 2
 3(include "test.scm")
 4
 5(import (chicken file)
 6        (chicken file posix)
 7        (chicken pathname)
 8        (chicken process-context)
 9        (chicken string))
10
11(define program-path
12  (cond-expand
13    ((and windows (not cygwin))
14     (string-translate (car (command-line-arguments)) "/" "\\"))
15    (else (car (command-line-arguments)))))
16
17(define (read-symbolic-link* p)
18  (cond-expand
19    ((and windows (not cygwin)) p)
20    (else (read-symbolic-link p #t))))
21
22(test-begin "executable tests")
23
24(let ((p (program-name)))
25  (test-equal "program-name"
26              (pathname-strip-directory p)
27              (pathname-strip-directory program-path)))
28
29(and-let* ((p (executable-pathname)))
30  (test-equal "executable-pathname"
31              (read-symbolic-link* p)
32              (read-symbolic-link* program-path)))
33
34(test-end)
35
36(test-exit)
Trap