From: bg66 Date: Fri, 4 Feb 2005 11:29:40 +0000 (+0000) Subject: * test/Makefile.am (EXTRA_DIST): Add test-riece-eval.el. X-Git-Tag: riece-1_0_7~27 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a67645858e2fbfb693903629886440c282ac6fb3;p=elisp%2Friece.git * test/Makefile.am (EXTRA_DIST): Add test-riece-eval.el. * test/test-riece-eval.el: New test cases. --- diff --git a/lisp/test/Makefile.am b/lisp/test/Makefile.am index 3c59516..7f76af1 100644 --- a/lisp/test/Makefile.am +++ b/lisp/test/Makefile.am @@ -1,3 +1,4 @@ EXTRA_DIST = luna.el lunit.el lunit-report.el \ test-riece.el test-riece-addon.el test-riece-alias.el \ - test-riece-log.el test-riece-url.el test-riece-yank.el \ No newline at end of file + test-riece-eval.el test-riece-log.el test-riece-url.el \ + test-riece-yank.el diff --git a/lisp/test/test-riece-eval.el b/lisp/test/test-riece-eval.el new file mode 100644 index 0000000..d4ec193 --- /dev/null +++ b/lisp/test/test-riece-eval.el @@ -0,0 +1,66 @@ +(require 'riece-eval) + +(luna-define-class test-riece-eval (lunit-test-case)) + +(luna-define-method test-riece-eval-string ((case test-riece-eval)) + (lunit-assert-2 + case + (equal + (riece-eval-form "\"abc\"") + "abc")) + (lunit-assert-2 + case + (equal + (riece-eval-form "(concat \"d\" \"e\" \"f\")") + "def"))) + +(luna-define-method test-riece-eval-list ((case test-riece-eval)) + (lunit-assert-2 + case + (equal + (riece-eval-form "'(a b c)") + "(a b c)")) + (lunit-assert-2 + case + (equal + (riece-eval-form "(cons 'd \"e\")") + "(d . \"e\")"))) + +(luna-define-method test-riece-eval-number ((case test-riece-eval)) + (lunit-assert-2 + case + (equal + (riece-eval-form "123") + "123")) + (lunit-assert-2 + case + (equal + (riece-eval-form "(+ 123 45.6)") + "168.6"))) + +(luna-define-method test-riece-eval-nil ((case test-riece-eval)) + (lunit-assert-2 + case + (equal + (riece-eval-form "nil") + "")) + (lunit-assert-2 + case + (equal + (riece-eval-form "'()") + ""))) + +(luna-define-method test-riece-eval-error ((case test-riece-eval)) + (let (riece-eval-ignore-error symbol) + (makunbound 'symbol) + (lunit-assert-2 + case + (equal + (riece-eval-form "symbol") + "Error evaluating symbol: (void-variable symbol)")) + (setq riece-eval-ignore-error t) + (lunit-assert-2 + case + (equal + (riece-eval-form "symbol") + nil))))