108 lines
3.6 KiB
Plaintext
108 lines
3.6 KiB
Plaintext
;; Function To Be Tested: compile-file
|
|
;;
|
|
;; Source: Guy L Steele's CLTL Chapter 25, Miscellaneous Features
|
|
;; Section: 25.1 The Compiler
|
|
;; Page: 439
|
|
;;
|
|
;; Created By: John Park
|
|
;;
|
|
;; Creation Date: Aug 25,1986
|
|
;;
|
|
;; Last Update:
|
|
;;
|
|
;; Filed As: {ERIS}<LISPCORE>CML>TEST>25-1-compile-file.test
|
|
;;
|
|
;;
|
|
;; Syntax: (compile-file input-pathname &key :output-file)
|
|
;;
|
|
;; Function Description: The input-pathname must be a valid file specifier, such as a
|
|
;; pathname. The defaults for input-filename are taken from the variable
|
|
;; *default-pathname-defaults*. The file should be a lisp source file; its contents
|
|
;; are compiled and written as a binary object file. The :output-file argument may
|
|
;; be used to specify an output pathname; it defaults in a manner appropriate to the
|
|
;; implementation's file system conventions.
|
|
;;
|
|
;; Argument(s): Input-pathname: pathname
|
|
;; :output-file(key):
|
|
;;
|
|
;; Constraints/Limitations: none
|
|
|
|
;; JRB commenting this test out until a better file can be found to test
|
|
#|
|
|
(do-test-group (" compile-file-test-setup"
|
|
:before (progn
|
|
(defun file-exist? (file)
|
|
(if (not (eq (probe-file file) nil)) t
|
|
nil))
|
|
|
|
(defun compile-source-file ()
|
|
(cond ((and(file-exist? '{erinyes}<test>tools>do-test)
|
|
(not (file-exist? '{erinyes}<test>tools>do-test.dcom)))
|
|
(compile-file '{erinyes}<test>tools>do-test))
|
|
((and (file-exist? '{eris}<test>tools>do-test)
|
|
(not (file-exist? '{eris}<test>tools>do-test)))
|
|
(compile-file '{eris}<test>tools>do-test))
|
|
(t nil)))
|
|
|
|
(defun compile-source-file-default ()
|
|
(cond ((and(file-exist? '{erinyes}<test>tools>do-test)
|
|
(not (file-exist? '{erinyes}<test>tools>do-test.dcom)))
|
|
(progn (rename-file '{erinyes}<test>tools>do-test
|
|
'{dsk}<lispfiles>do-test)
|
|
(compile-file 'do-test)))
|
|
((and (file-exist? '{eris}<test>tools>do-test)
|
|
(not (file-exist? '{eris}<test>tools>do-test.dcom)))
|
|
(progn (rename-file '{eris}<test>tools>do-test
|
|
'{dsk}<lispfiles>do-test)
|
|
(compile-file 'do-test)))
|
|
(t nil)))
|
|
|
|
(defun compile-source-output-file ()
|
|
(cond ((file-exist? '{erinyes}<test>tools>do-test)
|
|
(compile-file '{erinyes}<test>tools>do-test
|
|
:output-file
|
|
'{erinyes}<test>tools>do-test-output-file.dcom))
|
|
((file-exist? '{eris}<test>tools>do-test)
|
|
(compile-file '{eris}<test>tools>do-test
|
|
:output-file
|
|
'{eris}<lispcore>cml>do-test-output-file.dcom))
|
|
(t nil)))
|
|
|
|
|
|
(defun delete-compiled-file (file)
|
|
(cond ((file-exist? file) (delete-file file))
|
|
(t t)))
|
|
(defun move-file (from-file to-file)
|
|
(cond ((and (file-exist? from-file)(not (file-exist? to-file)))
|
|
(rename-file from-file to-file))
|
|
(t t)))))
|
|
|
|
(do-test "compile-file-test"
|
|
(and (compile-source-file)
|
|
(or(file-exist? '{erinyes}<test>tools>do-test.dcom)
|
|
(file-exist? '{eris}<test>tools>do-test.dcom))
|
|
(delete-compiled-file '{erinyes}<test>tools>do-test.dcom)
|
|
(delete-compiled-file '{eris}<test>tools>do-test.dcom)))
|
|
|
|
(do-test "compile-file-test(*default-pathname-defaults*)"
|
|
(and (compile-source-file-default)
|
|
(file-exist? '{dsk}<lispfiles>do-test.dcom)
|
|
(move-file 'do-test '{erinyes}<test>tools>do-test)
|
|
(move-file 'do-test '{eris}<lispcore>cml>do-test)))
|
|
|
|
(do-test "compile-file-test(:output-file)"
|
|
(and (compile-source-output-file)
|
|
(or (file-exist? '{erinyes}<test>tools>do-test-output-file.dcom)
|
|
(file-exist? '{eris}<lispcore>cml>do-test-output-file.dcom))
|
|
(delete-compiled-file
|
|
'{erinyes}<test>tools>do-test-output-file.dcom)
|
|
(delete-compiled-file
|
|
'{eris}<lispcore>cml>do-test-output-file.dcom))))
|
|
|#
|
|
(do-test "compile-file-no-test-yet" t)
|
|
STOP
|
|
|
|
|
|
|
|
|