; Copyright 2005-2007 Kevin Reid, under the terms of the MIT X license ; found at http://www.opensource.org/licenses/mit-license.html ................ (cl:in-package :e.lisp-test) (deftest node-arity.low (handler-case (make-instance 'e.kernel:|LiteralExpr| :elements '()) (e.elang:node-arity-error (c) (write-to-string c :readably nil :escape nil :pretty nil))) "Attempted to create a |LiteralExpr| with 0 children, COMMON-LISP:NIL, instead of 1-1.") ;; XXX print as () instead of NIL (deftest node-arity.high (handler-case (make-instance 'e.kernel:|LiteralExpr| :elements '(1 2)) (e.elang:node-arity-error (c) (write-to-string c :readably nil :escape nil :pretty nil))) "Attempted to create a |LiteralExpr| with 2 children, (1 2), instead of 1-1.") (deftest node-printing.readably (with-standard-io-syntax ;; package cl-user has unknown use list, so we use this one instead (let ((*package* #.*package*)) (write-to-string (make-instance 'e.kernel:|LiteralExpr| :elements '(1))))) "#.(MAKE-INSTANCE (QUOTE E.KERNEL:|LiteralExpr|) :ELEMENTS (QUOTE (1)))") (deftest node-printing.unreadably (with-standard-io-syntax (let ((*package* #.*package*)) (write-to-string (make-instance 'e.kernel:|LiteralExpr| :elements (QUOTE (1))) :readably nil))) "#") (deftest node-printing.no-eval (handler-case (with-standard-io-syntax (let ((*package* #.*package*) (*read-eval* nil)) (write-to-string (make-instance 'e.kernel:|LiteralExpr| :elements '(1))))) (print-not-readable () :expected)) :expected) (deftest node-printing.readably.broken (with-standard-io-syntax ;; package cl-user has unknown use list, so we use this one instead (let ((*package* #.*package*)) (write-to-string (allocate-instance (find-class 'e.kernel:|LiteralExpr|))))) "#.(MAKE-INSTANCE (QUOTE E.KERNEL:|LiteralExpr|))") (deftest node-printing.unreadably.broken (with-standard-io-syntax (let ((*package* #.*package*)) (write-to-string (allocate-instance (find-class 'e.kernel:|LiteralExpr|)) :readably nil))) "#") (deftest change-node-class (handler-case (change-class (make-instance 'e.kernel:|LiteralExpr| :elements '("a")) 'e.kernel:|NounExpr|) (error () :expected)) :expected)