File: executable-tests.scm

package info (click to toggle)
chicken 5.3.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,892 kB
  • sloc: ansic: 580,083; lisp: 71,987; tcl: 1,445; sh: 588; makefile: 60
file content (36 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;; Compiled executable tests

(include "test.scm")

(import (chicken file)
        (chicken file posix)
        (chicken pathname)
        (chicken process-context)
        (chicken string))

(define program-path
  (cond-expand
    ((and windows (not cygwin))
     (string-translate (car (command-line-arguments)) "/" "\\"))
    (else (car (command-line-arguments)))))

(define (read-symbolic-link* p)
  (cond-expand
    ((and windows (not cygwin)) p)
    (else (read-symbolic-link p #t))))

(test-begin "executable tests")

(let ((p (program-name)))
  (test-equal "program-name"
              (pathname-strip-directory p)
              (pathname-strip-directory program-path)))

(and-let* ((p (executable-pathname)))
  (test-equal "executable-pathname"
              (read-symbolic-link* p)
              (read-symbolic-link* program-path)))

(test-end)

(test-exit)