Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions scriptl-test.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(defsystem scriptl-test
:author "Gian Piero Carrubba <gpiero@rm-rf.it>"
:license "LLGPL"
:depends-on (:scriptl
:FiveAM
:inferior-shell)
:components ((:module "t"
:serial t
:components
((:file "io")))))
2 changes: 1 addition & 1 deletion src/packet-io-stream.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(in-package :scriptl)

(defclass packet-io-stream
(trivial-gray-streams:fundamental-stream)
(trivial-gray-streams:fundamental-character-stream)
((stream :initarg :stream :initform nil)))

(defmethod trivial-gray-streams:stream-write-sequence
Expand Down
38 changes: 38 additions & 0 deletions t/io.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(defpackage #:scriptl-test.io
(:use #:cl
#:FiveAM))

(in-package :scriptl-test.io)

(scriptl:start)
; there's a way for checking the server has started?
(sleep 1)

(defun eval-string (string)
(eval (read-from-string string)))

(defun run-test (string)
(uiop:call-with-temporary-file
(lambda (tmp)
(let ((tmpfile (namestring tmp)))
(scriptl:make-script tmpfile 'eval-string)
(inferior-shell:run/i `(,tmpfile ,string))))
:want-stream-p nil
:want-pathname-p t))

(defmacro test-finishes (name form)
`(test ,name (finishes (run-test (prin1-to-string ',form)))))

(def-suite output-io-suite
:description "The output I/O test suite.")

(in-suite output-io-suite)

(test-finishes format-t
(format t "ok~%"))
(test-finishes inferior-shell-echo
(inferior-shell:run '(/bin/echo ok)))
(test-finishes uiop-echo
(uiop:run-program '("/bin/echo" "ok") :output t))

(run! 'output-io-suite)