X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Ftest%2Fmain.lisp;h=20991a5ba9f95a4d800a04730edf5de5b91975f7;hb=refs%2Fheads%2F0.x;hp=e1176db52f48abf516acdb8a0e79039a73e06b47;hpb=981fd3d9a7ad7e2b2dc4e92c5b594e6b2684a888;p=wolf diff --git a/src/test/main.lisp b/src/test/main.lisp index e1176db..20991a5 100644 --- a/src/test/main.lisp +++ b/src/test/main.lisp @@ -1,14 +1,15 @@ +; Copyright 2022 Frank Duncan (frank@consxy.com) under AGPL3. See distributed LICENSE.txt. (in-package #:wolf-test) -(defvar *tests* nil) +(defparameter *tests* nil) -(defmacro deftest (filename success &optional msg line-no col-no) +(defmacro deftest (filename success &optional msg line-no col-no copyright-notice) `(push (lambda () (let ((green (format nil "~c[1;32m" #\Esc)) (red (format nil "~c[1;31m" #\Esc)) - (result (wolf:check-file ,filename))) + (result (wolf:check-file ,filename :copyright-notice ,copyright-notice))) (cond ((not (eql ,success (car result))) (format t "~A- ~A failed, expected ~A and got ~A~c[0m~%" @@ -55,3 +56,20 @@ (deftest #P"resources/unspacedforms.lisp" :failure "Multiline top level forms must be separated by a space" 4 0) (deftest #P"resources/whitespaceendline.lisp" :failure "No whitespace at end of line" 4 106) (deftest #P"resources/whitespacelines.lisp" :failure "No whitespace only lines" 1 1) +(deftest #P"resources/copyrightnotice.lisp" :success nil nil nil "; Copyright XXXX AGPL") +(deftest #P"resources/copyrightnotice.lisp" :failure "Must begin with in-package form" 0 0) +(deftest #P"resources/package.lisp" :failure "Must begin with specified copyright notice" 0 0 "; Copyright XXXX AGPL") +(deftest #P"resources/unmatchedending.lisp" :failure "Unmatched ending paren" 2 12) + +; This is not a check for actually validity, but rather that the check directory code +; checks the directory. +(push + (lambda () + (let + ((*standard-output* (make-broadcast-stream)) + (*error-output* (make-broadcast-stream))) + (wolf:pretty-print-check-directory #P"resources/dircheck" + :copyright-notice "; Copyright XXXX AGPL") + (wolf:pretty-print-check-directory #P"resources/dircheck")) + t) + *tests*)