aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichal Nazarewicz2014-06-05 16:37:45 +0200
committerMichal Nazarewicz2014-06-05 16:37:45 +0200
commitaf9a3b28c0ca250ed245bd54c8737792916fe4c6 (patch)
treee6547ebc6b75c57699cde2c3a8e07066ab73d110 /test
parenta1d799c25e4ad96dd2303ef2daa6cb51b5a0fe01 (diff)
downloademacs-af9a3b28c0ca250ed245bd54c8737792916fe4c6.tar.gz
emacs-af9a3b28c0ca250ed245bd54c8737792916fe4c6.zip
tildify.el: Fix end-regex building in `tildify-find-env'
* lisp/textmodes/tildify.el (tildify-find-env): The `tildify-ignored-environments-alist' allows the end-regex to be provided not as a static string but mix of strings and indexes of groups matched the begin-regex. For example, the “\verb!…!” TeX-command (where “!” is an arbitrary character) is handled using: ("\\\\verb\\*?\\(.\\)" . (1)) In the same way, the following should be supported as well: ("open-\\(.\\)" . ("end-" 1)) However the tildify-find-env function fails at (concat result (if (stringp (setq aux (car expression))) expression ; BUG: expression is a list (regexp-quote (match-string aux)))) where the string part is handled incorrectly. The most trivial fix would be to replace `expression' in the true-part of the if-statement with `aux', but instead, this commit optimises `tildify-find-env' by changing it to use `mapconcat' rather than open-coded while-loop. * tests/automated/tildify-tests.el (tildify-test-find-env-end-re-bug): New test validating fix to the above bug.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog6
-rw-r--r--test/automated/tildify-tests.el11
2 files changed, 17 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b6b3dd379a7..db32aae578b 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
12014-06-05 Michal Nazarewicz <mina86@mina86.com>
2
3 * automated/tildify-tests.el (tildify-test-find-env-end-re-bug): New
4 test checking end-regex building in `tildify-find-env' function when
5 integers (denoting capture groups) and strings are mixed together.
6
12014-06-02 Michael Albinus <michael.albinus@gmx.de> 72014-06-02 Michael Albinus <michael.albinus@gmx.de>
2 8
3 * automated/tramp-tests.el (tramp-remote-process-environment): Declare. 9 * automated/tramp-tests.el (tramp-remote-process-environment): Declare.
diff --git a/test/automated/tildify-tests.el b/test/automated/tildify-tests.el
index 4223029f626..25e9f22adf3 100644
--- a/test/automated/tildify-tests.el
+++ b/test/automated/tildify-tests.el
@@ -101,6 +101,17 @@ latter is missing, SENTENCE will be used in all placeholder positions."
101 (tildify-test--example-tex sentence sentence) 101 (tildify-test--example-tex sentence sentence)
102 (tildify-test--example-tex sentence with-nbsp)))) 102 (tildify-test--example-tex sentence with-nbsp))))
103 103
104
105(ert-deftest tildify-test-find-env-end-re-bug ()
106 "Tests generation of end-regex using mix of indexes and strings"
107 (with-temp-buffer
108 (let ((tildify-ignored-environments-alist
109 `((,major-mode ("foo\\|bar" . ("end-" 0))))))
110 (insert "foo whatever end-foo")
111 (goto-char (point-min))
112 (should (string-equal "end-foo" (tildify-find-env "foo\\|bar"))))))
113
114
104(provide 'tildify-tests) 115(provide 'tildify-tests)
105 116
106;;; tildify-tests.el ends here 117;;; tildify-tests.el ends here