From 508eaa3290963dd0ef07f99263d1171be3a6f85a Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 3 Aug 2023 11:56:42 +0200 Subject: [PATCH] Add test for align-regexp * test/lisp/align-tests.el (align-regexp): New test. * test/lisp/align-resources/align-regexp.erts: New file. * test/lisp/align-resources/c-mode.erts: Add new test case. --- test/lisp/align-resources/align-regexp.erts | 13 +++++++++++++ test/lisp/align-resources/c-mode.erts | 12 ++++++++++++ test/lisp/align-tests.el | 11 +++++++++++ 3 files changed, 36 insertions(+) create mode 100644 test/lisp/align-resources/align-regexp.erts diff --git a/test/lisp/align-resources/align-regexp.erts b/test/lisp/align-resources/align-regexp.erts new file mode 100644 index 00000000000..fbbd6d6bd33 --- /dev/null +++ b/test/lisp/align-resources/align-regexp.erts @@ -0,0 +1,13 @@ +Name: align function declaration + +=-= +Fred (123) 456-7890 +Alice (123) 456-7890 +Mary-Anne (123) 456-7890 +Joe (123) 456-7890 +=-= +Fred (123) 456-7890 +Alice (123) 456-7890 +Mary-Anne (123) 456-7890 +Joe (123) 456-7890 +=-=-= diff --git a/test/lisp/align-resources/c-mode.erts b/test/lisp/align-resources/c-mode.erts index 0a0fa046b34..ecdff507103 100644 --- a/test/lisp/align-resources/c-mode.erts +++ b/test/lisp/align-resources/c-mode.erts @@ -9,3 +9,15 @@ int main (int argc, char *argv[]); =-=-= + +Name: example from Commentary + +=-= + int a = 1; + short foo = 2; + double blah = 4; +=-= + int a = 1; + short foo = 2; + double blah = 4; +=-=-= diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el index dac23ef96d9..a4d9303827f 100644 --- a/test/lisp/align-tests.el +++ b/test/lisp/align-tests.el @@ -25,6 +25,8 @@ (require 'ert-x) (require 'align) +;;;; align + (defun test-align-transform-fun (function) (lambda () (funcall function) @@ -56,6 +58,15 @@ (ert-test-erts-file (ert-resource-file "conf-toml-mode.erts") (test-align-transform-fun #'conf-toml-mode)))) +;;;; align-regexp + +(ert-deftest align-regexp () + (let ((indent-tabs-mode nil)) + (ert-test-erts-file (ert-resource-file "align-regexp.erts") + (lambda () + (align-regexp (point-min) (point-max) + "\\(\\s-*\\)("))))) + (provide 'align-tests) ;;; align-tests.el ends here -- 2.39.2