unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22799: [PATCH] Unit tests for `forward-sexp'
@ 2016-02-24 19:50 Aaron S. Hawley
  2016-02-24 19:50 ` bug#22800: " Aaron S. Hawley
  2016-02-24 20:07 ` bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley
  0 siblings, 2 replies; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-24 19:50 UTC (permalink / raw)
  To: 22799

I had attempted to fix the forward-sexp function when run at the ends of the buffer in Bug#13994, but it was seen as too risky to fix and was closed.  I've taken the unit test I had submitted and am submitting it here.

This documents the existing behavior I pointed out in Bug#13994, but I also added tests for Bug#15014 (delete-pair of quotes in Text Mode), Bug#20492 (forward-sexp of symbols in quotes, comments, strings), Bug#11321 (forward-sexp on Python doc string), Bug#4030 (forward-sexp of unquoted semicolon char).

Seems like Bug#11321 can be closed as fixed.

Thanks for Emacs,
Aaron

PS. This is my first time sending with git send-email(1).  Hopefully, it behaved.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#22800: [PATCH] Unit tests for `forward-sexp'
  2016-02-24 19:50 bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley
@ 2016-02-24 19:50 ` Aaron S. Hawley
  2016-02-25  6:00   ` bug#22799: " Lars Ingebrigtsen
  2016-02-24 20:07 ` bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley
  1 sibling, 1 reply; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-24 19:50 UTC (permalink / raw)
  To: 22800; +Cc: Aaron S. Hawley

* test/lisp/forward-sexp-tests.el: New file.
---
 test/lisp/forward-sexp-tests.el | 199 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 199 insertions(+)
 create mode 100644 test/lisp/forward-sexp-tests.el

diff --git a/test/lisp/forward-sexp-tests.el b/test/lisp/forward-sexp-tests.el
new file mode 100644
index 0000000..6eb13ae
--- /dev/null
+++ b/test/lisp/forward-sexp-tests.el
@@ -0,0 +1,199 @@
+;;; forward-sexp-tests.el --- Test forward-sexp and related functions  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2013-2016  Free Software Foundation, Inc.
+
+;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
+;; Keywords: internal
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Testing of `forward-sexp'.
+
+;;; Code:
+
+(require 'ert)
+
+(ert-deftest forward-sexp-1 ()
+  "Test basics of \\[forward-sexp]."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null
+      (forward-sexp 1)))))
+
+(ert-deftest forward-sexp-1-error-mismatch ()
+  "Test basics of \\[forward-sexp]."
+  (with-temp-buffer
+    (insert "(")
+    (goto-char (point-min))
+    (should-error
+      (forward-sexp 1))))
+
+(ert-deftest forward-sexp-backward-1 ()
+  "Test basics of \\[backward-sexp]."
+  (with-temp-buffer
+    (insert "()")
+    (should (null
+      (forward-sexp -1)))))
+
+(ert-deftest forwrad-sexp-backward-1-error-mismatch ()
+  "Test mismatched parens with \\[backward-sexp]."
+  (with-temp-buffer
+    (insert "(")
+    (should-error
+      (forward-sexp -1))))
+
+(ert-deftest forward-sexp-1-eobp ()
+  "Test \\[forward-sexp] at `eobp'."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+      (forward-sexp 1)))))
+
+(ert-deftest forward-sexp-backward-1-eobp ()
+  "Test \\[backward-sexp] at `bobp'."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -1)))))
+
+(ert-deftest forward-sexp-2-eobp ()
+  "Test \\[forward-sexp] beyond `eobp'."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 2)))
+    (should (eobp))))
+
+(ert-deftest forward-sexp-backward-2-bobp ()
+  "Test \\[backward-sexp] beyond `bobp'."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -2)))
+    (should (bobp))))
+
+(ert-deftest forward-sexp-2-eobp-and-subsequent ()
+  "Test \\[forward-sexp] beyond `eobp' and again."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 2)))
+    (should (eobp))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 1)))))
+
+(ert-deftest forward-sexp-backward-2-bobp-and-subsequent ()
+  "Test \\[backward-sexp] ahead of `bobp' and again."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -2)))
+    (should (bobp))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -1)))))
+
+(ert-deftest forward-sexp-delete-pair-parens ()
+  "Test \\[delete-pair] with parens."
+  (with-temp-buffer
+    (insert "(foo)")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "foo" (buffer-string)))))
+
+(ert-deftest forward-sexp-delete-pair-quotes ()
+  "Test \\[delete-pair] with quotation marks."
+  (with-temp-buffer
+    (insert "\"foo\"")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "foo" (buffer-string)))))
+
+(ert-deftest forward-sexp-delete-pair-quotes-in-text-mode ()
+  "Test \\[delete-pair] against string in Text Mode for #15014."
+  (with-temp-buffer
+    (text-mode)
+    (insert "\"foo\"")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "fo\"" (buffer-string)))))
+
+(ert-deftest forward-sexp-delete-pair-quotes-text-mode-syntax-table ()
+  "Test \\[delete-pair] with modified Text Mode syntax for #15014."
+  (with-temp-buffer
+    (text-mode)
+    (let ((st (copy-syntax-table text-mode-syntax-table)))
+      (with-syntax-table st
+        ;; (modify-syntax-entry ?\" "." text-mode-syntax-table)
+        (modify-syntax-entry ?\" "$" st)
+        (insert "\"foo\"")
+        (goto-char (point-min))
+        (delete-pair)
+        (should (string-equal "foo" (buffer-string)))))))
+
+(ert-deftest forward-sexp-elisp-inside-symbol ()
+  "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "hide-ifdef-env ")
+    (insert (concat (number-sequence 32 126)))
+    (goto-char (point-min))
+    (re-search-forward "hide" nil t) ;; (forward-char 4)
+    (should (looking-at "-"))
+    (forward-sexp)
+    (should (looking-at " "))))
+
+(ert-deftest forward-sexp-elisp-quoted-symbol ()
+  "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "`hide-ifdef-env'.")
+    (goto-char (point-min))
+    (re-search-forward "hide" nil t) ;; (forward-char 5)
+    (should (= ?- (char-after)))
+    (forward-sexp)
+    (should (= ?. (char-before)))))
+
+(ert-deftest forward-sexp-python-triple-quoted-string ()
+  "Test \\[forward-sexp] on Python doc strings for #11321."
+  (with-temp-buffer
+    (insert "\"\"\"Triple-quoted string\"\"\"")
+    (goto-char (point-min))
+    (python-mode)
+    (forward-sexp)
+    (should (eobp))))
+
+(ert-deftest forward-sexp-emacs-lisp-semi-char-error ()
+  "Test \\[forward-sexp] on expression with unquoted semicolon per #4030."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(insert ?;)")
+    (goto-char (point-min))
+    (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error.
+
+(ert-deftest forward-sexp-emacs-lisp-quote-char ()
+  "Test \\[forward-sexp] on expression with unquoted quote per #4030."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(insert ?\")")
+    (goto-char (point-min))
+    (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error.
+
+(provide 'forward-sexp-tests)
+;;; forward-sexp-tests.el ends here
-- 
2.3.0 (Apple Git-54)






^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#22799: [PATCH] Unit tests for `forward-sexp'
  2016-02-24 19:50 bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley
  2016-02-24 19:50 ` bug#22800: " Aaron S. Hawley
@ 2016-02-24 20:07 ` Aaron S. Hawley
  1 sibling, 0 replies; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-24 20:07 UTC (permalink / raw)
  To: 22799

> PS. This is my first time sending with git send-email(1).  Hopefully, it behaved.

Looks like it didn't behave.  The patch ended up at Bug#22800, and not here.

I was hoping Debbugs, or at least the bug-gnu-emacs alias, respected
the In-Reply-To: header to make it go to the right place.

In the future, I'll be sure to intervene with git send-email(2) when
multiple mails are sent with and force things to get sent to the
correct debbugs email alias.

Apologies,
Aaron





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#22799: bug#22800: [PATCH] Unit tests for `forward-sexp'
  2016-02-24 19:50 ` bug#22800: " Aaron S. Hawley
@ 2016-02-25  6:00   ` Lars Ingebrigtsen
  2016-02-25 15:40     ` bug#22799: [PATCH] Unit tests for `forward-sexp' and related commands Aaron S. Hawley
  2016-02-25 15:45     ` bug#22800: " Aaron S. Hawley
  0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-25  6:00 UTC (permalink / raw)
  To: Aaron S. Hawley; +Cc: 22800, 22799

"Aaron S. Hawley" <aaron.s.hawley@gmail.com> writes:

> diff --git a/test/lisp/forward-sexp-tests.el b/test/lisp/forward-sexp-tests.el

If I've understood the naming methodology in the Emacs test harness, all
the -tests.el files have to be named after a file under ../lisp/
somewhere.  Since there isn't a lisp/forward-sexp.el file, running the
tests fail:

larsi@mouse:~/src/emacs/trunk/test$ make lisp/forward-sexp-tests
make[1]: Entering directory '/home/larsi/src/emacs/trunk/test'
make[1]: *** No rule to make target '/home/larsi/src/emacs/trunk/test/../lisp/forward-sexp.el', needed by 'lisp/forward-sexp-tests.log'.  Stop.
make[1]: Leaving directory '/home/larsi/src/emacs/trunk/test'
Makefile:142: recipe for target 'lisp/forward-sexp-tests' failed
make: *** [lisp/forward-sexp-tests] Error 2


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#22799: [PATCH] Unit tests for `forward-sexp' and related commands
  2016-02-25  6:00   ` bug#22799: " Lars Ingebrigtsen
@ 2016-02-25 15:40     ` Aaron S. Hawley
  2016-02-25 15:45     ` bug#22800: " Aaron S. Hawley
  1 sibling, 0 replies; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-25 15:40 UTC (permalink / raw)
  To: 22799

I apologize.  I was trying to contribute unit tests while bypassing the build process.

I am able to verify that it works in the test harness, now, and will submit a new patch under a separate cover.

$ make -C test lisp/emacs-lisp/lisp-tests
make[2]: `lisp/emacs-lisp/lisp-tests.elc' is up to date.
Testing lisp/emacs-lisp/lisp-tests.elc
Running 20 tests (2016-02-25 10:28:47-0500)
   passed   1/20  lisp-backward-sexp-1-empty-parens
   passed   2/20  lisp-backward-sexp-1-eobp
   passed   3/20  lisp-backward-sexp-1-error-mismatch
   passed   4/20  lisp-backward-sexp-2-bobp
   passed   5/20  lisp-backward-sexp-2-bobp-and-subsequent
   passed   6/20  lisp-delete-pair-parens
   passed   7/20  lisp-delete-pair-quotation-marks
   passed   8/20  lisp-delete-pair-quotes-in-text-mode
   passed   9/20  lisp-delete-pair-quotes-text-mode-syntax-table
   passed  10/20  lisp-forward-sexp-1-empty-parens
   passed  11/20  lisp-forward-sexp-1-eobp
   passed  12/20  lisp-forward-sexp-1-error-mismatch
   passed  13/20  lisp-forward-sexp-2-eobp
   passed  14/20  lisp-forward-sexp-2-eobp-and-subsequent
   passed  15/20  lisp-forward-sexp-elisp-inside-symbol
   passed  16/20  lisp-forward-sexp-elisp-quoted-symbol
   passed  17/20  lisp-forward-sexp-emacs-lisp-quote-char
   passed  18/20  lisp-forward-sexp-emacs-lisp-semi-char-error
   passed  19/20  lisp-forward-sexp-python-triple-quoted-string
   passed  20/20  lisp-forward-sexp-python-triple-quotes-string

Ran 20 tests, 20 results as expected (2016-02-25 10:28:47-0500)







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#22800: [PATCH] Unit tests for `forward-sexp' and related commands
  2016-02-25  6:00   ` bug#22799: " Lars Ingebrigtsen
  2016-02-25 15:40     ` bug#22799: [PATCH] Unit tests for `forward-sexp' and related commands Aaron S. Hawley
@ 2016-02-25 15:45     ` Aaron S. Hawley
  2016-02-25 15:45       ` Aaron S. Hawley
  1 sibling, 1 reply; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-25 15:45 UTC (permalink / raw)
  To: 22800

I apologize.  I was trying to contribute unit tests while bypassing the build process.

I am able to verify that it works in the test harness, now, and will submit a new patch under a separate cover.

$ make -C test lisp/emacs-lisp/lisp-tests
make[2]: `lisp/emacs-lisp/lisp-tests.elc' is up to date.
Testing lisp/emacs-lisp/lisp-tests.elc
Running 20 tests (2016-02-25 10:28:47-0500)
   passed   1/20  lisp-backward-sexp-1-empty-parens
   passed   2/20  lisp-backward-sexp-1-eobp
   passed   3/20  lisp-backward-sexp-1-error-mismatch
   passed   4/20  lisp-backward-sexp-2-bobp
   passed   5/20  lisp-backward-sexp-2-bobp-and-subsequent
   passed   6/20  lisp-delete-pair-parens
   passed   7/20  lisp-delete-pair-quotation-marks
   passed   8/20  lisp-delete-pair-quotes-in-text-mode
   passed   9/20  lisp-delete-pair-quotes-text-mode-syntax-table
   passed  10/20  lisp-forward-sexp-1-empty-parens
   passed  11/20  lisp-forward-sexp-1-eobp
   passed  12/20  lisp-forward-sexp-1-error-mismatch
   passed  13/20  lisp-forward-sexp-2-eobp
   passed  14/20  lisp-forward-sexp-2-eobp-and-subsequent
   passed  15/20  lisp-forward-sexp-elisp-inside-symbol
   passed  16/20  lisp-forward-sexp-elisp-quoted-symbol
   passed  17/20  lisp-forward-sexp-emacs-lisp-quote-char
   passed  18/20  lisp-forward-sexp-emacs-lisp-semi-char-error
   passed  19/20  lisp-forward-sexp-python-triple-quoted-string
   passed  20/20  lisp-forward-sexp-python-triple-quotes-string

Ran 20 tests, 20 results as expected (2016-02-25 10:28:47-0500)







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#22800: [PATCH] Unit tests for `forward-sexp' and related commands
  2016-02-25 15:45     ` bug#22800: " Aaron S. Hawley
@ 2016-02-25 15:45       ` Aaron S. Hawley
  2016-02-26  5:49         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron S. Hawley @ 2016-02-25 15:45 UTC (permalink / raw)
  To: 22800; +Cc: Aaron S. Hawley

* test/lisp/emacs-lisp/lisp-tests.el: New file.
---
 test/lisp/emacs-lisp/lisp-tests.el | 211 +++++++++++++++++++++++++++++++++++++
 1 file changed, 211 insertions(+)
 create mode 100644 test/lisp/emacs-lisp/lisp-tests.el

diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el
new file mode 100644
index 0000000..4fe20f0
--- /dev/null
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -0,0 +1,211 @@
+;;; lisp-tests.el --- Test Lisp editing commands     -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2013-2016  Free Software Foundation, Inc.
+
+;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
+;; Keywords: internal
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Testing of `forward-sexp' and related functions.
+
+;;; Code:
+
+(require 'ert)
+(require 'python)
+
+(ert-deftest lisp-forward-sexp-1-empty-parens ()
+  "Test basics of \\[forward-sexp]."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null
+      (forward-sexp 1)))))
+
+(ert-deftest lisp-forward-sexp-1-error-mismatch ()
+  "Test basics of \\[forward-sexp]."
+  (with-temp-buffer
+    (insert "(")
+    (goto-char (point-min))
+    (should-error
+      (forward-sexp 1))))
+
+(ert-deftest lisp-backward-sexp-1-empty-parens ()
+  "Test basics of \\[backward-sexp]."
+  (with-temp-buffer
+    (insert "()")
+    (should (null
+      (forward-sexp -1)))))
+
+(ert-deftest lisp-backward-sexp-1-error-mismatch ()
+  "Test mismatched parens with \\[backward-sexp]."
+  (with-temp-buffer
+    (insert "(")
+    (should-error
+      (forward-sexp -1))))
+
+(ert-deftest lisp-forward-sexp-1-eobp ()
+  "Test \\[forward-sexp] at `eobp'."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+      (forward-sexp 1)))))
+
+(ert-deftest lisp-backward-sexp-1-eobp ()
+  "Test \\[backward-sexp] at `bobp'."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -1)))))
+
+(ert-deftest lisp-forward-sexp-2-eobp ()
+  "Test \\[forward-sexp] beyond `eobp'."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 2)))
+    (should (eobp))))
+
+(ert-deftest lisp-backward-sexp-2-bobp ()
+  "Test \\[backward-sexp] beyond `bobp'."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -2)))
+    (should (bobp))))
+
+(ert-deftest lisp-forward-sexp-2-eobp-and-subsequent ()
+  "Test \\[forward-sexp] beyond `eobp' and again."
+  (with-temp-buffer
+    (insert "()")
+    (goto-char (point-min))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 2)))
+    (should (eobp))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp 1)))))
+
+(ert-deftest lisp-backward-sexp-2-bobp-and-subsequent ()
+  "Test \\[backward-sexp] ahead of `bobp' and again."
+  (with-temp-buffer
+    (insert "()")
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -2)))
+    (should (bobp))
+    (should (null ;; (should-error ;; No, per #13994
+     (forward-sexp -1)))))
+
+(ert-deftest lisp-delete-pair-parens ()
+  "Test \\[delete-pair] with parens."
+  (with-temp-buffer
+    (insert "(foo)")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "foo" (buffer-string)))))
+
+(ert-deftest lisp-delete-pair-quotation-marks ()
+  "Test \\[delete-pair] with quotation marks."
+  (with-temp-buffer
+    (insert "\"foo\"")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "foo" (buffer-string)))))
+
+(ert-deftest lisp-delete-pair-quotes-in-text-mode ()
+  "Test \\[delete-pair] against string in Text Mode for #15014."
+  (with-temp-buffer
+    (text-mode)
+    (insert "\"foo\"")
+    (goto-char (point-min))
+    (delete-pair)
+    (should (string-equal "fo\"" (buffer-string)))))
+
+(ert-deftest lisp-delete-pair-quotes-text-mode-syntax-table ()
+  "Test \\[delete-pair] with modified Text Mode syntax for #15014."
+  (with-temp-buffer
+    (text-mode)
+    (let ((st (copy-syntax-table text-mode-syntax-table)))
+      (with-syntax-table st
+        ;; (modify-syntax-entry ?\" "." text-mode-syntax-table)
+        (modify-syntax-entry ?\" "$" st)
+        (insert "\"foo\"")
+        (goto-char (point-min))
+        (delete-pair)
+        (should (string-equal "foo" (buffer-string)))))))
+
+(ert-deftest lisp-forward-sexp-elisp-inside-symbol ()
+  "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "hide-ifdef-env ")
+    (insert (concat (number-sequence 32 126)))
+    (goto-char (point-min))
+    (re-search-forward "hide" nil t) ;; (forward-char 4)
+    (should (looking-at "-"))
+    (forward-sexp)
+    (should (looking-at " "))))
+
+(ert-deftest lisp-forward-sexp-elisp-quoted-symbol ()
+  "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "`hide-ifdef-env'.")
+    (goto-char (point-min))
+    (re-search-forward "hide" nil t) ;; (forward-char 5)
+    (should (= ?- (char-after)))
+    (forward-sexp)
+    (should (= ?. (char-before)))))
+
+(ert-deftest lisp-forward-sexp-python-triple-quoted-string ()
+  "Test \\[forward-sexp] on Python doc strings for #11321."
+  (with-temp-buffer
+    (insert "\"\"\"Triple-quoted string\"\"\"")
+    (goto-char (point-min))
+    (let ((python-indent-guess-indent-offset nil))
+      (python-mode))
+    (forward-sexp)
+    (should (eobp))))
+
+(ert-deftest lisp-forward-sexp-python-triple-quotes-string ()
+  "Test \\[forward-sexp] on Python doc strings for #11321."
+  (with-temp-buffer
+    (insert "'''Triple-quoted string'''")
+    (goto-char (point-min))
+    (let ((python-indent-guess-indent-offset nil))
+      (python-mode))
+    (forward-sexp)
+    (should (eobp))))
+
+(ert-deftest lisp-forward-sexp-emacs-lisp-semi-char-error ()
+  "Test \\[forward-sexp] on expression with unquoted semicolon per #4030."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(insert ?;)")
+    (goto-char (point-min))
+    (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error.
+
+(ert-deftest lisp-forward-sexp-emacs-lisp-quote-char ()
+  "Test \\[forward-sexp] on expression with unquoted quote per #4030."
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(insert ?\")")
+    (goto-char (point-min))
+    (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error.
+
+(provide 'lisp-tests)
+;;; lisp-tests.el ends here
-- 
2.3.0 (Apple Git-54)






^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#22800: [PATCH] Unit tests for `forward-sexp' and related commands
  2016-02-25 15:45       ` Aaron S. Hawley
@ 2016-02-26  5:49         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-26  5:49 UTC (permalink / raw)
  To: Aaron S. Hawley; +Cc: 22800

"Aaron S. Hawley" <aaron.s.hawley@gmail.com> writes:

> * test/lisp/emacs-lisp/lisp-tests.el: New file.

Thanks; applied to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-26  5:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24 19:50 bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley
2016-02-24 19:50 ` bug#22800: " Aaron S. Hawley
2016-02-25  6:00   ` bug#22799: " Lars Ingebrigtsen
2016-02-25 15:40     ` bug#22799: [PATCH] Unit tests for `forward-sexp' and related commands Aaron S. Hawley
2016-02-25 15:45     ` bug#22800: " Aaron S. Hawley
2016-02-25 15:45       ` Aaron S. Hawley
2016-02-26  5:49         ` Lars Ingebrigtsen
2016-02-24 20:07 ` bug#22799: [PATCH] Unit tests for `forward-sexp' Aaron S. Hawley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).