Added tests for some process-state functions.

This commit is contained in:
frese 2001-03-20 14:36:54 +00:00
parent 94553d1c36
commit 1b31a9f8f1
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,45 @@
;;; Tests for the functions in section 3.5 of the scsh-manual "Process state"
;;; Author: David Frese
;; Notes: Only umask and cwd stuff, everything else isn't implemented yet.
;; --- umask stuff ---
(add-test! 'with-umask 'process-state
(lambda (new-umask)
(let ((old-umask (umask)))
(and
(with-umask new-umask
(= (umask) new-umask))
(= (umask) old-umask))))
0)
(add-test! 'set-umask 'process-state
(lambda (new-umask)
(let ((old-umask (umask)))
(set-umask new-umask)
(let ((res (umask)))
(set-umask old-umask)
(= res new-umask))))
7)
;; --- cwd stuff ---
(add-test! 'with-cwd 'process-state
(lambda (new-cwd)
(let ((old-cwd (cwd)))
(and
(with-cwd new-cwd
(equal? (cwd) new-cwd))
(equal? (cwd) old-cwd))))
"/bin")
(add-test! 'chdir 'process-state
(lambda (new-cwd)
(let ((old-cwd (cwd)))
(chdir new-cwd)
(let ((res (cwd)))
(chdir old-cwd)
(equal? res new-cwd))))
"/tmp")

View File

@ -19,3 +19,9 @@
scheme
scsh-test)
(files file-system-tests))
(define-structure process-state-test (export)
(open scsh
scheme
scsh-test)
(files process-state-tests))