12.07.2015 Views

LIsp Framework for Testing - Common Lisp.net

LIsp Framework for Testing - Common Lisp.net

LIsp Framework for Testing - Common Lisp.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Simple Example(defparameter *filename* "test-file")(defparameter *test-data* '(1 2 3 4));; setup(with-open-file(s *filename* :direction :output)(write *test-data* :stream s))==> (1 2 3 4);; the test(with-open-file (s *filename*)(equal (read s) *test-data*))==> T(deftest test-file-system () ()((filename "test-file")(data (data'(1 '(12 23 34)))4)))(:setup(:setup(with-open-file(with-open-file(s(sfilenamefilename:direction :output):direction :output)(write data :stream s)))(write data :stream s)))(:teardown (delete-file filename)))(:teardown (delete-file filename)))(addtest (test-file-system)read-what-was-written(addtest (test-file-system)(with-open-file (s filename)read-what-was-written(ensure (equal (read s) data))))(with-open-file (s filename)==> (prints) Test passed!(ensure (equal (read s) data))))==> (prints) Test passed!;; cleanup(delete-file *filename*)Success!October 2003University of Massachusetts, AmherstGary King - EKSL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!