diff tests/automated/regexp-tests.el @ 4504:b82fdf7305ee

Correct the implementation, add a few basic tests for #'skip-chars-quote. tests/ChangeLog addition: 2008-08-27 Aidan Kehoe <kehoea@parhasard.net> * automated/regexp-tests.el: Add a few basic #'skip-chars-forward, #'skip-chars-backward tests. lisp/ChangeLog addition: 2008-08-27 Aidan Kehoe <kehoea@parhasard.net> * subr.el (skip-chars-quote): Correct the implementation, following the docstring of #'skip-char-forward more closely rather than the documentation of character classes in the Lispref.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 27 Aug 2008 21:47:21 +0200
parents 3660d327399f
children 5e8f6469169f
line wrap: on
line diff
--- a/tests/automated/regexp-tests.el	Wed Aug 27 00:39:09 2008 +0200
+++ b/tests/automated/regexp-tests.el	Wed Aug 27 21:47:21 2008 +0200
@@ -522,6 +522,22 @@
 						     2))
       )))
 
+;; Not very comprehensive tests of skip-chars-forward, skip-chars-background: 
+
+(with-string-as-buffer-contents 
+    "-]-----------------------------][]]------------------------"
+  (skip-chars-forward (skip-chars-quote "-[]"))
+  (Assert (= (point) (point-max)))
+  (skip-chars-backward (skip-chars-quote "-[]"))
+  (Assert (= (point) (point-min)))
+  ;; Testing in passing for an old bug in #'skip-chars-forward where I
+  ;; thought it was impossible to call it with a string containing only ?-
+  ;; and ?]: 
+  (Assert (= (skip-chars-forward (skip-chars-quote "-]"))
+             (position ?[ (buffer-string) :test #'=)))
+  ;; This used to error, incorrectly: 
+  (Assert (skip-chars-quote "[-")))
+
 ;; replace-match (REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER)
 
 ;; #### Write some tests!  Much functionality is implicitly tested above