From a67645858e2fbfb693903629886440c282ac6fb3 Mon Sep 17 00:00:00 2001 From: bg66 Date: Fri, 4 Feb 2005 11:29:40 +0000 Subject: [PATCH] * test/Makefile.am (EXTRA_DIST): Add test-riece-eval.el. * test/test-riece-eval.el: New test cases. --- lisp/test/Makefile.am | 3 +- lisp/test/test-riece-eval.el | 66 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 lisp/test/test-riece-eval.el 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)))) -- 1.7.10.4