~ chicken-core (master) /tests/executable-tests.scm
Trap1;;; 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 (car (command-line-arguments)))
13
14(define (read-symbolic-link* p)
15 (cond-expand
16 ((and windows (not cygwin)) p)
17 (else (read-symbolic-link p #t))))
18
19(test-begin "executable tests")
20
21(let ((p (program-name)))
22 (test-equal "program-name"
23 (pathname-strip-directory p)
24 (pathname-strip-directory program-path)))
25
26(and-let* ((p (executable-pathname)))
27 (test-equal "executable-pathname"
28 (read-symbolic-link* p)
29 (read-symbolic-link* program-path)))
30
31(test-end)
32
33(test-exit)