From 1a06f7ea2dd0fa49245e7c198b25c615dafb0fe1 Mon Sep 17 00:00:00 2001 From: David Lichteblau Date: Sun, 4 Mar 2007 19:07:10 +0100 Subject: [PATCH] updated for proper klacks assertion conditions --- TEST | 65 +++++++++++++++++++++++++++++++++++++++++--------------------- parse.lisp | 63 +++++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 84 insertions(+), 44 deletions(-) diff --git a/TEST b/TEST index aa3dd4b..db9f49e 100644 --- a/TEST +++ b/TEST @@ -8,13 +8,16 @@ 008: PASS: invalid schema: except not allowed here 009: FAIL: didn't detect invalid schema 010: FAIL: didn't detect invalid schema -011: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS -012: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +011: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +012: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 013: PASS: invalid schema: notAllowed not allowed here 014: PASS: invalid schema: start not allowed here 015: PASS: invalid schema: start not allowed here 016: PASS: invalid schema: start not allowed here -017: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +017: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 018: PASS: invalid schema: element not allowed here 019: PASS: invalid schema: element not allowed here 020: FAIL: didn't detect invalid schema @@ -83,13 +86,15 @@ 080: FAIL: didn't detect invalid schema 081: FAIL: didn't detect invalid schema 082: PASS: invalid schema: start not allowed here -083: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +083: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 084: PASS: invalid schema: attribute not allowed here 085: FAIL: didn't detect invalid schema 086: PASS: invalid schema: element not allowed here 087: FAIL: incorrect condition type: unknown &KEY argument: :TYPE 088: PASS -089: FAIL: expected END-ELEMENT but got CHARACTERS +089: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 090: FAIL: invalid schema: start not allowed here 091: FAIL: invalid schema: start not allowed here 092: FAIL: invalid schema: start not allowed here @@ -192,12 +197,15 @@ 159: PASS: invalid schema: start not allowed here 160: PASS: invalid schema: start not allowed here 161: PASS: invalid schema: start not allowed here -162: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +162: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 163: PASS -164: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +164: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 165: PASS: invalid schema: notAllowed not allowed here 166: PASS: invalid schema: start not allowed here -167: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +167: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 168: PASS: invalid schema: attribute not allowed here 169: PASS: invalid schema: attribute not allowed here 170: PASS: invalid schema: attribute not allowed here @@ -205,7 +213,8 @@ 172: PASS: invalid schema: attribute not allowed here 173: PASS: invalid schema: attribute not allowed here 174: PASS: invalid schema: attribute not allowed here -175: FAIL: incorrect condition type: expected END-ELEMENT but got CHARACTERS +175: PASS: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 176: PASS 177: PASS: invalid schema: param not allowed here 178: FAIL: didn't detect invalid schema @@ -257,33 +266,45 @@ 224: FAIL: invalid schema: element not allowed here 225: FAIL: unknown &KEY argument: :POSSIBILITY 226: FAIL: unknown &KEY argument: :POSSIBILITY -227: FAIL: expected END-ELEMENT but got CHARACTERS +227: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 228: FAIL: unknown &KEY argument: :POSSIBILITY 229: FAIL: unknown &KEY argument: :POSSIBILITY -230: FAIL: expected END-ELEMENT but got CHARACTERS -231: FAIL: expected END-ELEMENT but got CHARACTERS -232: FAIL: expected END-ELEMENT but got CHARACTERS -233: FAIL: expected END-ELEMENT but got CHARACTERS -234: FAIL: expected END-ELEMENT but got CHARACTERS +230: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +231: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +232: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +233: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +234: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 235: PASS -236: FAIL: expected END-ELEMENT but got CHARACTERS +236: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 237: FAIL: unknown &KEY argument: :POSSIBILITY 238: FAIL: unknown &KEY argument: :POSSIBILITY 239: FAIL: unknown &KEY argument: :POSSIBILITY -240: FAIL: expected END-ELEMENT but got CHARACTERS +240: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 241: PASS 242: FAIL: unknown &KEY argument: :POSSIBILITY 243: FAIL: unknown &KEY argument: :POSSIBILITY 244: FAIL: unknown &KEY argument: :POSSIBILITY -245: FAIL: expected END-ELEMENT but got CHARACTERS +245: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 246: FAIL: unknown &KEY argument: :POSSIBILITY 247: FAIL: unknown &KEY argument: :POSSIBILITY 248: FAIL: invalid schema: attribute not allowed here -249: FAIL: expected END-ELEMENT but got CHARACTERS +249: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 250: FAIL: unknown &KEY argument: :POSSIBILITY 251: FAIL: unknown &KEY argument: :POSSIBILITY -252: FAIL: expected END-ELEMENT but got CHARACTERS -253: FAIL: expected END-ELEMENT but got CHARACTERS +252: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + +253: FAIL: Cannot parse schema: Klacks assertion failed: expected END-ELEMENT but got CHARACTERS + 254: FAIL: invalid schema: attribute not allowed here 255: FAIL: invalid schema: attribute not allowed here 256: FAIL: invalid schema: attribute not allowed here @@ -404,4 +425,4 @@ 371: FAIL: incorrect condition type: unknown &KEY argument: :POSSIBILITY 372: FAIL: invalid schema: start not allowed here 373: FAIL: invalid schema: notAllowed not allowed here -Passed 176/373 tests. +Passed 184/373 tests. diff --git a/parse.lisp b/parse.lisp index f4cc2a3..f9211b4 100644 --- a/parse.lisp +++ b/parse.lisp @@ -514,33 +514,52 @@ ;;;; tests -(defun test (&optional (p "/home/david/src/lisp/cxml-rng/spec-split/*")) - (dribble "/home/david/src/lisp/cxml-rng/TEST") +(defun run-tests (&optional (p "/home/david/src/lisp/cxml-rng/spec-split/*")) + (dribble "/home/david/src/lisp/cxml-rng/TEST" :if-exists :rename-and-delete) (let ((pass 0) (total 0)) (dolist (d (directory p)) (let ((name (car (last (pathname-directory d))))) (when (parse-integer name :junk-allowed t) (incf total) - (let* ((i (merge-pathnames "i.rng" d)) - (c (merge-pathnames "c.rng" d))) - (format t "~A: " name) - (if (probe-file c) - (handler-case - (progn - (parse-relax-ng c) - (format t " PASS~%") - (incf pass)) - (error (c) - (format t " FAIL: ~A~%" c))) - (handler-case - (progn - (parse-relax-ng i) - (format t " FAIL: didn't detect invalid schema~%")) - (rng-error (c) - (format t " PASS: ~A~%" c) - (incf pass)) - (error (c) - (format t " FAIL: incorrect condition type: ~A~%" c)))))))) + (when (test1 d) + (incf pass))))) (format t "Passed ~D/~D tests.~%" pass total)) (dribble)) + +(defun run-test (n &optional (p "/home/david/src/lisp/cxml-rng/spec-split/")) + (test1 (merge-pathnames (format nil "~3,'0D/" n) p))) + +(defun parse-test (n &optional (p "/home/david/src/lisp/cxml-rng/spec-split/")) + (let* ((d (merge-pathnames (format nil "~3,'0D/" n) p)) + (i (merge-pathnames "i.rng" d)) + (c (merge-pathnames "c.rng" d)) + (rng (if (probe-file c) c i))) + (format t "~A: " (car (last (pathname-directory d)))) + (print rng) + (parse-relax-ng rng))) + +(defun test1 (d) + (let* ((i (merge-pathnames "i.rng" d)) + (c (merge-pathnames "c.rng" d))) + (format t "~A: " (car (last (pathname-directory d)))) + (if (probe-file c) + (handler-case + (progn + (parse-relax-ng c) + (format t " PASS~%") + t) + (error (c) + (format t " FAIL: ~A~%" c) + nil)) + (handler-case + (progn + (parse-relax-ng i) + (format t " FAIL: didn't detect invalid schema~%") + nil) + (rng-error (c) + (format t " PASS: ~A~%" c) + t) + (error (c) + (format t " FAIL: incorrect condition type: ~A~%" c) + nil))))) -- 2.11.4.GIT