diff --git a/net.sockets-tests.asd b/iolib-tests.asd similarity index 87% rename from net.sockets-tests.asd rename to iolib-tests.asd index 8add24f5..caa7061e 100644 --- a/net.sockets-tests.asd +++ b/iolib-tests.asd @@ -24,11 +24,13 @@ ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;;; DEALINGS IN THE SOFTWARE. -(asdf:defsystem :net.sockets-tests - :description "Socket library test suite." +(defsystem iolib-tests + :description "IOLib test suite." :licence "MIT" - :depends-on (:net.sockets :rt) + :depends-on (io.streams net.sockets rt) :pathname (merge-pathnames (make-pathname :directory '(:relative "tests")) *load-truename*) :components - ((:file "net.sockets-tests"))) + ((:file "pkgdcl") + (:file "streams" :depends-on ("pkgdcl")) + (:file "sockets" :depends-on ("pkgdcl")))) diff --git a/tests/hebrew_utf-8_cr.txt b/tests/data/hebrew_utf-8_cr.txt similarity index 100% rename from tests/hebrew_utf-8_cr.txt rename to tests/data/hebrew_utf-8_cr.txt diff --git a/tests/hebrew_utf-8_crlf.txt b/tests/data/hebrew_utf-8_crlf.txt similarity index 100% rename from tests/hebrew_utf-8_crlf.txt rename to tests/data/hebrew_utf-8_crlf.txt diff --git a/tests/hebrew_utf-8_lf.txt b/tests/data/hebrew_utf-8_lf.txt similarity index 100% rename from tests/hebrew_utf-8_lf.txt rename to tests/data/hebrew_utf-8_lf.txt diff --git a/tests/kafka_latin-1_cr.txt b/tests/data/kafka_latin-1_cr.txt similarity index 100% rename from tests/kafka_latin-1_cr.txt rename to tests/data/kafka_latin-1_cr.txt diff --git a/tests/kafka_latin-1_crlf.txt b/tests/data/kafka_latin-1_crlf.txt similarity index 100% rename from tests/kafka_latin-1_crlf.txt rename to tests/data/kafka_latin-1_crlf.txt diff --git a/tests/kafka_latin-1_lf.txt b/tests/data/kafka_latin-1_lf.txt similarity index 100% rename from tests/kafka_latin-1_lf.txt rename to tests/data/kafka_latin-1_lf.txt diff --git a/tests/kafka_utf-8_cr.txt b/tests/data/kafka_utf-8_cr.txt similarity index 100% rename from tests/kafka_utf-8_cr.txt rename to tests/data/kafka_utf-8_cr.txt diff --git a/tests/kafka_utf-8_crlf.txt b/tests/data/kafka_utf-8_crlf.txt similarity index 100% rename from tests/kafka_utf-8_crlf.txt rename to tests/data/kafka_utf-8_crlf.txt diff --git a/tests/kafka_utf-8_lf.txt b/tests/data/kafka_utf-8_lf.txt similarity index 100% rename from tests/kafka_utf-8_lf.txt rename to tests/data/kafka_utf-8_lf.txt diff --git a/tests/russian_utf-8_cr.txt b/tests/data/russian_utf-8_cr.txt similarity index 100% rename from tests/russian_utf-8_cr.txt rename to tests/data/russian_utf-8_cr.txt diff --git a/tests/russian_utf-8_crlf.txt b/tests/data/russian_utf-8_crlf.txt similarity index 100% rename from tests/russian_utf-8_crlf.txt rename to tests/data/russian_utf-8_crlf.txt diff --git a/tests/russian_utf-8_lf.txt b/tests/data/russian_utf-8_lf.txt similarity index 100% rename from tests/russian_utf-8_lf.txt rename to tests/data/russian_utf-8_lf.txt diff --git a/tests/tilton_ascii_cr.txt b/tests/data/tilton_ascii_cr.txt similarity index 100% rename from tests/tilton_ascii_cr.txt rename to tests/data/tilton_ascii_cr.txt diff --git a/tests/tilton_ascii_crlf.txt b/tests/data/tilton_ascii_crlf.txt similarity index 100% rename from tests/tilton_ascii_crlf.txt rename to tests/data/tilton_ascii_crlf.txt diff --git a/tests/tilton_ascii_lf.txt b/tests/data/tilton_ascii_lf.txt similarity index 100% rename from tests/tilton_ascii_lf.txt rename to tests/data/tilton_ascii_lf.txt diff --git a/tests/tilton_utf-8_cr.txt b/tests/data/tilton_utf-8_cr.txt similarity index 100% rename from tests/tilton_utf-8_cr.txt rename to tests/data/tilton_utf-8_cr.txt diff --git a/tests/tilton_utf-8_crlf.txt b/tests/data/tilton_utf-8_crlf.txt similarity index 100% rename from tests/tilton_utf-8_crlf.txt rename to tests/data/tilton_utf-8_crlf.txt diff --git a/tests/tilton_utf-8_lf.txt b/tests/data/tilton_utf-8_lf.txt similarity index 100% rename from tests/tilton_utf-8_lf.txt rename to tests/data/tilton_utf-8_lf.txt diff --git a/tests/unicode_demo_utf-8_cr.txt b/tests/data/unicode_demo_utf-8_cr.txt similarity index 100% rename from tests/unicode_demo_utf-8_cr.txt rename to tests/data/unicode_demo_utf-8_cr.txt diff --git a/tests/unicode_demo_utf-8_crlf.txt b/tests/data/unicode_demo_utf-8_crlf.txt similarity index 100% rename from tests/unicode_demo_utf-8_crlf.txt rename to tests/data/unicode_demo_utf-8_crlf.txt diff --git a/tests/unicode_demo_utf-8_lf.txt b/tests/data/unicode_demo_utf-8_lf.txt similarity index 100% rename from tests/unicode_demo_utf-8_lf.txt rename to tests/data/unicode_demo_utf-8_lf.txt diff --git a/io.streams-tests.asd b/tests/pkgdcl.lisp similarity index 71% rename from io.streams-tests.asd rename to tests/pkgdcl.lisp index 78fc6e31..00eb187a 100644 --- a/io.streams-tests.asd +++ b/tests/pkgdcl.lisp @@ -1,6 +1,6 @@ -;;;; -*- Mode: lisp; indent-tabs-mode: nil -*- +;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*- ;;; -;;; io.streams-tests.asd --- ASDF system definition. +;;; pkgdcl.lisp --- Package definition. ;;; ;;; Copyright (C) 2007, Luis Oliveira ;;; @@ -24,12 +24,8 @@ ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;;; DEALINGS IN THE SOFTWARE. -(asdf:defsystem io.streams-tests - :description "Test suite for io-streams." - :author "Luis Oliveira " - :licence "BSD" - :depends-on (:rt :io.streams :alexandria) - :pathname (merge-pathnames (make-pathname :directory '(:relative "tests")) - *load-truename*) - :components - ((:file "io.streams-tests"))) +(in-package #:cl-user) + +(defpackage #:iolib-tests + (:use #:common-lisp #:rtest #:net.sockets #:io.streams + #:trivial-gray-streams #:alexandria)) diff --git a/tests/net.sockets-tests.lisp b/tests/sockets.lisp similarity index 98% rename from tests/net.sockets-tests.lisp rename to tests/sockets.lisp index 5bef0cff..83edd52e 100644 --- a/tests/net.sockets-tests.lisp +++ b/tests/sockets.lisp @@ -1,6 +1,6 @@ ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Indent-tabs-mode: NIL -*- ;;; -;;; tests.lisp --- net.sockets test suite. +;;; sockets.lisp --- net.sockets test suite. ;;; ;;; Copyright (C) 2007, Luis Oliveira ;;; @@ -31,13 +31,7 @@ ;;; released into the public domain in jurisdictions where this is ;;; possible, or under the FreeBSD licence where not. -(in-package #:common-lisp-user) - -(defpackage #:net.sockets-tests - (:nicknames #:sockets-tests) - (:use #:common-lisp #:rtest :net.sockets)) - -(in-package #:net.sockets-tests) +(in-package #:iolib-tests) ;;; A couple of these tests require an echo server. You can either ;;; compile and run the provided tests/echo-server.c or enabled the @@ -424,7 +418,7 @@ :type nil :defaults (asdf:system-definition-pathname - (asdf:find-system '#:net.sockets-tests)))))) + (asdf:find-system '#:iolib-tests)))))) (ignore-errors (delete-file file)) (with-socket (p :family :local :connect :passive :local-filename file) (with-socket (a :family :local :remote-filename file) diff --git a/tests/io.streams-tests.lisp b/tests/streams.lisp similarity index 94% rename from tests/io.streams-tests.lisp rename to tests/streams.lisp index 19d744f0..a7bf080a 100644 --- a/tests/io.streams-tests.lisp +++ b/tests/streams.lisp @@ -1,6 +1,6 @@ ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*- ;;; -;;; tests.lisp --- IO.STREAMS test suite. +;;; streams.lisp --- IO.STREAMS test suite. ;;; ;;; Copyright (c) 2006-2007, Dr. Edmund Weitz. All rights reserved. ;;; Copyright (c) 2007, Luis Oliveira @@ -29,13 +29,7 @@ ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(in-package :common-lisp-user) - -(defpackage #:io.streams-tests - (:use #:common-lisp :rt :io.streams :alexandria - :trivial-gray-streams)) - -(in-package #:io.streams-tests) +(in-package #:iolib-tests) (defclass my-file-stream (dual-channel-single-fd-gray-stream) ((path :initarg :path :reader file-stream-path))) @@ -56,6 +50,7 @@ (:input :error) ((:io :output) :create))) (external-format :default)) + (declare (ignore if-does-not-exist)) ;; move OPEN to INITIALIZE-INSTANCE (let ((fd (nix:open path (logior (ecase direction @@ -80,10 +75,11 @@ (with-open-stream (,var ,stream) ,@body)))) -(defvar *this-dir* +(defvar *data-dir* (let ((sys-pn (asdf:system-definition-pathname - (asdf:find-system 'io.streams-tests)))) - (make-pathname :directory (append (pathname-directory sys-pn) '("tests")) + (asdf:find-system 'iolib-tests)))) + (make-pathname :directory (append (pathname-directory sys-pn) + '("tests" "data")) :defaults sys-pn))) (defvar *test-dir* @@ -171,9 +167,9 @@ ;;; check if the outcome is as expected. Uses various variants of the ;;; :DIRECTION keyword when opening the files." (defun compare-files (path-in external-format-in path-out external-format-out) - (let ((full-path-in (merge-pathnames path-in *this-dir*)) + (let ((full-path-in (merge-pathnames path-in *data-dir*)) (full-path-out (merge-pathnames path-out *test-dir*)) - (full-path-orig (merge-pathnames path-out *this-dir*))) + (full-path-orig (merge-pathnames path-out *data-dir*))) (dolist (direction-out '(:output :io) t) (dolist (direction-in '(:input :io)) (let ((description (format nil "Test ~S ~A [~A] --> ~A [~A]" @@ -188,7 +184,7 @@ (format *error-output* "~&;; Test failed!!!~%") (return-from compare-files nil))))))) -(deftest big-comparision-test +(deftest big-stream-comparision-test (let ((args-list (loop for (file-name symbols) in *test-files* nconc (create-test-combinations file-name symbols)))) (loop for args in args-list