;;;; posix-utils-test.scm -*- Hen -*- (use test) (use posix posix-utils) (test-group "misc" ; (define eol (cond-expand (windows "\r\n") (unix "\n") (else "\r") ) ) ; (test "foo" (string-trim-eol (string-append "foo" eol))) (test "" (string-trim-eol eol)) (test "foo" (string-trim-eol "foo")) ) (test-group "environment variables" (setenv "FOO" "yes") (setenv "BAR" "") (setenv "BAZ" "not on your life") (test-assert (environment-variable-bound? "FOO")) (test "yes" (environment-variable-bound? "FOO")) (test-assert (not (environment-variable-bound? "BAR"))) (test-assert (environment-variable-true? "FOO")) (test-assert (not (environment-variable-true? "BAR"))) (test-assert (not (environment-variable-true? "BAZ"))) ; (test '("A=a" "Z=0") (environment-variables->environment-list '(("A" . a) ("Z" . 0)))) ) (test-group "shell variables" (test-assert "OSTYPE" (get-shell-variable "OSTYPE")) (test-assert "OSTYPE (can fail)" (shell-variable-bound? "OSTYPE")) ) (test-exit)