diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/eval-tests.el | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index b2b7dfefda5..3c3e7033419 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el | |||
| @@ -39,31 +39,40 @@ | |||
| 39 | (ert-deftest eval-tests--bugs-24912-and-24913 () | 39 | (ert-deftest eval-tests--bugs-24912-and-24913 () |
| 40 | "Check that Emacs doesn't accept weird argument lists. | 40 | "Check that Emacs doesn't accept weird argument lists. |
| 41 | Bug#24912 and Bug#24913." | 41 | Bug#24912 and Bug#24913." |
| 42 | (dolist (args '((&rest &optional) | 42 | (dolist (lb '(t false)) |
| 43 | (&rest a &optional) (&rest &optional a) | 43 | (ert-info ((prin1-to-string lb) :prefix "lexical-binding: ") |
| 44 | (&optional &optional) (&optional &optional a) | 44 | (let ((lexical-binding lb)) |
| 45 | (&optional a &optional b) | 45 | (dolist (args '((&rest &optional) |
| 46 | (&rest &rest) (&rest &rest a) | 46 | (&rest a &optional) (&rest &optional a) |
| 47 | (&rest a &rest b))) | 47 | (&optional &optional) (&optional &optional a) |
| 48 | (should-error (eval `(funcall (lambda ,args)) t) :type 'invalid-function) | 48 | (&optional a &optional b) |
| 49 | (should-error (byte-compile-check-lambda-list args)) | 49 | (&rest &rest) (&rest &rest a) |
| 50 | (let ((byte-compile-debug t)) | 50 | (&rest a &rest b) |
| 51 | (ert-info ((format "bytecomp: args = %S" args)) | 51 | (&rest) (&optional &rest) |
| 52 | (should-error (eval `(byte-compile (lambda ,args)) t)))))) | 52 | )) |
| 53 | 53 | (ert-info ((prin1-to-string args) :prefix "args: ") | |
| 54 | (ert-deftest eval-tests-accept-empty-optional-rest () | 54 | (should-error |
| 55 | "Check that Emacs accepts empty &optional and &rest arglists. | 55 | (eval `(funcall (lambda ,args)) lb) :type 'invalid-function) |
| 56 | (should-error (byte-compile-check-lambda-list args)) | ||
| 57 | (let ((byte-compile-debug t)) | ||
| 58 | (should-error (eval `(byte-compile (lambda ,args)) lb))))))))) | ||
| 59 | |||
| 60 | (ert-deftest eval-tests-accept-empty-optional () | ||
| 61 | "Check that Emacs accepts empty &optional arglists. | ||
| 56 | Bug#24912." | 62 | Bug#24912." |
| 57 | (dolist (args '((&optional) (&rest) (&optional &rest) | 63 | (dolist (lb '(t false)) |
| 58 | (&optional &rest a) (&optional a &rest))) | 64 | (ert-info ((prin1-to-string lb) :prefix "lexical-binding: ") |
| 59 | (let ((fun `(lambda ,args 'ok))) | 65 | (let ((lexical-binding lb)) |
| 60 | (ert-info ("eval") | 66 | (dolist (args '((&optional) (&optional &rest a))) |
| 61 | (should (eq (funcall (eval fun t)) 'ok))) | 67 | (ert-info ((prin1-to-string args) :prefix "args: ") |
| 62 | (ert-info ("byte comp check") | 68 | (let ((fun `(lambda ,args 'ok))) |
| 63 | (byte-compile-check-lambda-list args)) | 69 | (ert-info ("eval") |
| 64 | (ert-info ("bytecomp") | 70 | (should (eq (funcall (eval fun lb)) 'ok))) |
| 65 | (let ((byte-compile-debug t)) | 71 | (ert-info ("byte comp check") |
| 66 | (should (eq (funcall (byte-compile fun)) 'ok))))))) | 72 | (byte-compile-check-lambda-list args)) |
| 73 | (ert-info ("bytecomp") | ||
| 74 | (let ((byte-compile-debug t)) | ||
| 75 | (should (eq (funcall (byte-compile fun)) 'ok))))))))))) | ||
| 67 | 76 | ||
| 68 | 77 | ||
| 69 | (dolist (form '(let let*)) | 78 | (dolist (form '(let let*)) |