diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2016-06-21 16:52:52 +0200 |
---|---|---|
committer | Michal Nazarewicz <mina86@mina86.com> | 2016-07-04 23:44:06 +0200 |
commit | dc294483af221066724f1007a595016b47fb5814 (patch) | |
tree | e81eb0d46998ec2d634de6d6df64c346ca63fb0b /test | |
parent | e3ae3c44882085bf52f6bb8b02e98eb7d0b1f81b (diff) |
Make ‘delete-trailing-whitespace’ delete spaces after form feed
* lisp/simple.el (delete-trailing-whitespace): Treat form fead as
a non-whitespace character (regradless of whether it’s character syntax
is whitespace) and delete any whitespace following it instead of leaving
lines with form feeds completely unchanged. I.e. a line like "\f " will
now became "\f".
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/simple-tests.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 40cd1d2949..2722544446 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -204,7 +204,7 @@ ;;; `delete-trailing-whitespace' -(ert-deftest simple-delete-trailing-whitespace () +(ert-deftest simple-delete-trailing-whitespace--bug-21766 () "Test bug#21766: delete-whitespace sometimes deletes non-whitespace." (defvar python-indent-guess-indent-offset) ; to avoid a warning (let ((python (featurep 'python)) @@ -219,11 +219,24 @@ "\n" "\n")) (delete-trailing-whitespace) - (should (equal (count-lines (point-min) (point-max)) 3))) + (should (string-equal (buffer-string) + (concat "query = \"\"\"WITH filtered AS\n" + "WHERE\n" + "\"\"\".format(fv_)\n")))) ;; Let's clean up if running interactive (unless (or noninteractive python) (unload-feature 'python))))) +(ert-deftest simple-delete-trailing-whitespace--formfeeds () + "Test formfeeds are not deleted but whitespace past them is." + (with-temp-buffer + (with-syntax-table (make-syntax-table) + (modify-syntax-entry ?\f " ") ; Make sure \f is whitespace + (insert " \f \n \f \f \n\nlast\n") + (delete-trailing-whitespace) + (should (string-equal (buffer-string) " \f\n \f \f\n\nlast\n")) + (should (equal ?\s (char-syntax ?\f)))))) + ;;; auto-boundary tests (ert-deftest undo-auto-boundary-timer () |