From 1b31a9f8f1964ce1f3e932c64769e35713b455d8 Mon Sep 17 00:00:00 2001 From: frese Date: Tue, 20 Mar 2001 14:36:54 +0000 Subject: [PATCH] Added tests for some process-state functions. --- scsh/test/process-state-tests.scm | 45 +++++++++++++++++++++++++++++++ scsh/test/test-packages.scm | 8 +++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scsh/test/process-state-tests.scm diff --git a/scsh/test/process-state-tests.scm b/scsh/test/process-state-tests.scm new file mode 100644 index 0000000..5f08cc1 --- /dev/null +++ b/scsh/test/process-state-tests.scm @@ -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") + diff --git a/scsh/test/test-packages.scm b/scsh/test/test-packages.scm index 854e184..193c4b7 100644 --- a/scsh/test/test-packages.scm +++ b/scsh/test/test-packages.scm @@ -18,4 +18,10 @@ (open scsh scheme scsh-test) - (files file-system-tests)) \ No newline at end of file + (files file-system-tests)) + +(define-structure process-state-test (export) + (open scsh + scheme + scsh-test) + (files process-state-tests)) \ No newline at end of file