]> git.eshelyaron.com Git - emacs.git/commitdiff
Add one more mod-test test
authorEli Zaretskii <eliz@gnu.org>
Tue, 24 Nov 2015 19:13:46 +0000 (21:13 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 24 Nov 2015 19:13:46 +0000 (21:13 +0200)
* modules/mod-test/test.el (mod-test-sum-test): Test the error
signaled when the function is invoked with a wrong number of
arguments.

modules/mod-test/test.el

index 98ce46411bd7987e09243de3f5ac2c1a9bca6fce..34090d9b062be1d8095541cff84b89a1383b6df0 100644 (file)
 ;;
 
 (ert-deftest mod-test-sum-test ()
-  (should (= (mod-test-sum 1 2) 3)))
+  (should (= (mod-test-sum 1 2) 3))
+  (let ((descr (should-error (mod-test-sum 1 2 3))))
+    (should (eq (car descr) 'wrong-number-of-arguments))
+    (should (stringp (nth 1 descr)))
+    (should (eq 0
+                (string-match
+                 (if (eq system-type 'windows-nt)
+                     "#<module function at \\(0x\\)?[0-9a-fA-F]+ from .*>"
+                   "#<module function Fmod_test_sum from .*>")
+                 (nth 1 descr))))
+    (should (= (nth 2 descr) 3))))
 
 (ert-deftest mod-test-sum-docstring ()
   (should (string= (documentation 'mod-test-sum) "Return A + B")))