Moar tests!
Mon Jan 25 07:38:54 UTC 2010 pix@kepibu.org
* Moar tests!
hunk ./test/unification-tests.lisp 206
+(define-condition inner-error (unification-failure) ())
+
hunk ./test/unification-tests.lisp 215
+
+ (test-error (match ('(x) '(x) :errorp nil)
+ (error 'inner-error))
+ :condition-type 'inner-error
+ :known-failure t)
+
+ (test-error (matchf ((x) '(x) :errorp nil)
+ (error 'inner-error))
+ :condition-type 'inner-error
+ :known-failure t)
+
+ (with-tests (:name "final t-or-otherwise")
+ (test :success (matching ()
+ (('x 'y) :fail)
+ (t :success)))
+ (test :success (matching ()
+ (('x 'y) :fail)
+ (otherwise :success)))
+ (test :success (match-case ('x)
+ ('y :fail)
+ (t :success)))
+ (test :success (match-case ('x)
+ ('y :fail)
+ (otherwise :success)))
+ (test :success (matchf-case ('(x))
+ ((y) :fail)
+ (t :success)))
+ (test :success (matchf-case ('(x))
+ ((y) :fail)
+ (otherwise :success))))
+
+ (test-error (matching ()
+ (('x 'y) :fail)
+ (('x 'x) (error 'inner-error))
+ (('?x 'x) x))
+ :condition-type 'inner-error)
+
+ (test-error (match-case ('(x))
+ ('(y) :fail)
+ ('(x) (error 'inner-error))
+ ('(?x) x))
+ :condition-type 'inner-error
+ :known-failure t)
+
+ (test-error (matchf-case ('(x))
+ ((y) :fail)
+ ((x) (error 'inner-error))
+ ((?x) x))
+ :condition-type 'inner-error
+ :known-failure t)
+
+ (test 'sym (match-case ('(sym))
+ ('(a) :fail)
+ ('(b) :fail)
+ ('(?x) x)))
+
+ (test 'sym (matchf-case ('(sym))
+ ((a) :fail)
+ ((b) :fail)
+ ((?x) x)))