diff options
| author | Stefan Kangas | 2023-03-20 06:30:32 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2023-03-20 06:30:32 +0100 |
| commit | 20d8a1cf4bdc1de994b5c39a8ee02af657416c56 (patch) | |
| tree | 542aff7d6767542a42e4fb6a84c69f4dece073ef /test | |
| parent | f615968fe1b4726e3914aa65e4b7c6c6be07ea70 (diff) | |
| parent | ea87c54f359e3d98b4f21a0904206b3696b4bb74 (diff) | |
| download | emacs-20d8a1cf4bdc1de994b5c39a8ee02af657416c56.tar.gz emacs-20d8a1cf4bdc1de994b5c39a8ee02af657416c56.zip | |
Merge from origin/emacs-29
ea87c54f359 ; * lisp/subr.el (setq-local): Add missing period (bug#62...
90362f87d58 ; Correct last commit, downcase node reference
38067f05b92 Enhance section about troubleshooting in Eglot manual.
6f82596b490 Fix Eglot's snippet insertion to follow the manual
c54bda15e35 Reset abbrevs-changed after saving abbrevs (bug#62208)
e8cee15f780 ; Fix markup in previous change
e4a7d0cd6ea Document `keymap-unset' in lispref
bb3e0ded9eb Don't add a key binding when REMOVE is non-nil
a4a9ffdd80a Fix the documentation of various aspects of adding Xref h...
a2222b9a9bf ; Minor wording fix in ELisp reference manual
5cf1de683b2 Fix python-fill-paragraph problems on filling strings (bu...
7385c991dff Also exempt eglot-inlay-hints-mode from desktop.el's fumb...
1961bdb52ed ; Add WebDAV entry to index in Tramp manual
dfb36d36230 Refer to EWW instead of w3 and w3m
9d3fdf7e0d4 Fix Eglot's command generation for code actions
# Conflicts:
# etc/NEWS
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/abbrev-tests.el | 16 | ||||
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 119 |
2 files changed, 135 insertions, 0 deletions
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el index ecca21df4bc..7b2780309b0 100644 --- a/test/lisp/abbrev-tests.el +++ b/test/lisp/abbrev-tests.el | |||
| @@ -305,6 +305,22 @@ | |||
| 305 | (should-not (abbrev-table-p translation-table-vector)) | 305 | (should-not (abbrev-table-p translation-table-vector)) |
| 306 | (should (abbrev-table-p (make-abbrev-table)))) | 306 | (should (abbrev-table-p (make-abbrev-table)))) |
| 307 | 307 | ||
| 308 | (ert-deftest abbrev--possibly-save-test () | ||
| 309 | "Test that `abbrev--possibly-save' properly resets | ||
| 310 | `abbrevs-changed'." | ||
| 311 | (ert-with-temp-file temp-test-file | ||
| 312 | (let ((abbrev-file-name temp-test-file) | ||
| 313 | (save-abbrevs t)) | ||
| 314 | ;; Save | ||
| 315 | (let ((abbrevs-changed t)) | ||
| 316 | (should-not (abbrev--possibly-save nil t)) | ||
| 317 | (should-not abbrevs-changed)) | ||
| 318 | ;; Don't save | ||
| 319 | (let ((abbrevs-changed t)) | ||
| 320 | (ert-simulate-keys '(?n) | ||
| 321 | (should (abbrev--possibly-save nil))) | ||
| 322 | (should-not abbrevs-changed))))) | ||
| 323 | |||
| 308 | (provide 'abbrev-tests) | 324 | (provide 'abbrev-tests) |
| 309 | 325 | ||
| 310 | ;;; abbrev-tests.el ends here | 326 | ;;; abbrev-tests.el ends here |
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index e5a9d128bc5..ed4a08da6ab 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -255,6 +255,27 @@ aliqua." | |||
| 255 | 255 | ||
| 256 | ;;; Font-lock and syntax | 256 | ;;; Font-lock and syntax |
| 257 | 257 | ||
| 258 | (ert-deftest python-syntax-context-1 () | ||
| 259 | (python-tests-with-temp-buffer | ||
| 260 | " | ||
| 261 | # Comment | ||
| 262 | s = 'Single Quoted String' | ||
| 263 | t = '''Triple Quoted String''' | ||
| 264 | p = (1 + 2) | ||
| 265 | " | ||
| 266 | (python-tests-look-at "Comment") | ||
| 267 | (should (= (python-syntax-context 'comment) (pos-bol))) | ||
| 268 | (python-tests-look-at "Single") | ||
| 269 | (should (= (python-syntax-context 'string) (1- (point)))) | ||
| 270 | (should (= (python-syntax-context 'single-quoted-string) (1- (point)))) | ||
| 271 | (should-not (python-syntax-context 'triple-quoted-string)) | ||
| 272 | (python-tests-look-at "Triple") | ||
| 273 | (should (= (python-syntax-context 'string) (1- (point)))) | ||
| 274 | (should-not (python-syntax-context 'single-quoted-string)) | ||
| 275 | (should (= (python-syntax-context 'triple-quoted-string) (1- (point)))) | ||
| 276 | (python-tests-look-at "1 + 2") | ||
| 277 | (should (= (python-syntax-context 'paren) (1- (point)))))) | ||
| 278 | |||
| 258 | (ert-deftest python-syntax-after-python-backspace () | 279 | (ert-deftest python-syntax-after-python-backspace () |
| 259 | ;; `python-indent-dedent-line-backspace' garbles syntax | 280 | ;; `python-indent-dedent-line-backspace' garbles syntax |
| 260 | (python-tests-with-temp-buffer | 281 | (python-tests-with-temp-buffer |
| @@ -2052,6 +2073,54 @@ this is a test this is a test this is a test this is a test this is a test this | |||
| 2052 | (fill-paragraph) | 2073 | (fill-paragraph) |
| 2053 | (should (= (current-indentation) 0)))) | 2074 | (should (= (current-indentation) 0)))) |
| 2054 | 2075 | ||
| 2076 | (ert-deftest python-fill-paragraph-single-quoted-string-1 () | ||
| 2077 | "Single quoted string should not be filled." | ||
| 2078 | (let ((contents " | ||
| 2079 | s = 'abc def ghi jkl mno pqr stu vwx yz' | ||
| 2080 | ") | ||
| 2081 | (fill-column 20)) | ||
| 2082 | (python-tests-with-temp-buffer | ||
| 2083 | contents | ||
| 2084 | (python-tests-look-at "abc") | ||
| 2085 | (fill-paragraph) | ||
| 2086 | (should (string= (buffer-substring-no-properties (point-min) (point-max)) | ||
| 2087 | contents))))) | ||
| 2088 | |||
| 2089 | (ert-deftest python-fill-paragraph-single-quoted-string-2 () | ||
| 2090 | "Ensure no fill is performed after the end of the single quoted string." | ||
| 2091 | (let ((contents " | ||
| 2092 | s1 = 'abc' | ||
| 2093 | s2 = 'def' | ||
| 2094 | ")) | ||
| 2095 | (python-tests-with-temp-buffer | ||
| 2096 | contents | ||
| 2097 | (python-tests-look-at "abc") | ||
| 2098 | (fill-paragraph) | ||
| 2099 | (should (string= (buffer-substring-no-properties (point-min) (point-max)) | ||
| 2100 | contents))))) | ||
| 2101 | |||
| 2102 | (ert-deftest python-fill-paragraph-triple-quoted-string-1 () | ||
| 2103 | "Triple quoted string should be filled." | ||
| 2104 | (let ((contents " | ||
| 2105 | s = '''abc def ghi jkl mno pqr stu vwx yz''' | ||
| 2106 | ") | ||
| 2107 | (expected " | ||
| 2108 | s = '''abc def ghi | ||
| 2109 | jkl mno pqr stu vwx | ||
| 2110 | yz''' | ||
| 2111 | ") | ||
| 2112 | (fill-column 20)) | ||
| 2113 | (dolist (look-at '("'''abc" "z'''")) | ||
| 2114 | (dolist (offset '(0 1 2 3)) | ||
| 2115 | (python-tests-with-temp-buffer | ||
| 2116 | contents | ||
| 2117 | (python-tests-look-at look-at) | ||
| 2118 | (forward-char offset) | ||
| 2119 | (fill-paragraph) | ||
| 2120 | (should (string= | ||
| 2121 | (buffer-substring-no-properties (point-min) (point-max)) | ||
| 2122 | expected))))))) | ||
| 2123 | |||
| 2055 | 2124 | ||
| 2056 | ;;; Mark | 2125 | ;;; Mark |
| 2057 | 2126 | ||
| @@ -6491,6 +6560,56 @@ class Class: | |||
| 6491 | (python-tests-look-at "'''Not a method docstring.'''") | 6560 | (python-tests-look-at "'''Not a method docstring.'''") |
| 6492 | (should (not (python-info-docstring-p))))) | 6561 | (should (not (python-info-docstring-p))))) |
| 6493 | 6562 | ||
| 6563 | (ert-deftest python-info-triple-quoted-string-p-1 () | ||
| 6564 | "Test triple quoted string." | ||
| 6565 | (python-tests-with-temp-buffer | ||
| 6566 | " | ||
| 6567 | t = '''Triple''' | ||
| 6568 | " | ||
| 6569 | (python-tests-look-at " '''Triple") | ||
| 6570 | (should-not | ||
| 6571 | (python-tests-should-not-move | ||
| 6572 | #'python-info-triple-quoted-string-p)) | ||
| 6573 | (forward-char) | ||
| 6574 | (let ((start-pos (+ (point) 2)) | ||
| 6575 | (eol (pos-eol))) | ||
| 6576 | (while (< (point) eol) | ||
| 6577 | (should (= (python-tests-should-not-move | ||
| 6578 | #'python-info-triple-quoted-string-p) | ||
| 6579 | start-pos)) | ||
| 6580 | (forward-char))) | ||
| 6581 | (dolist (pos `(,(point) ,(point-min) ,(point-max))) | ||
| 6582 | (goto-char pos) | ||
| 6583 | (should-not | ||
| 6584 | (python-tests-should-not-move | ||
| 6585 | #'python-info-triple-quoted-string-p))))) | ||
| 6586 | |||
| 6587 | (ert-deftest python-info-triple-quoted-string-p-2 () | ||
| 6588 | "Test empty triple quoted string." | ||
| 6589 | (python-tests-with-temp-buffer | ||
| 6590 | " | ||
| 6591 | e = '''''' | ||
| 6592 | " | ||
| 6593 | (python-tests-look-at "''''''") | ||
| 6594 | (let ((start-pos (+ (point) 2)) | ||
| 6595 | (eol (pos-eol))) | ||
| 6596 | (while (< (point) eol) | ||
| 6597 | (should (= (python-tests-should-not-move | ||
| 6598 | #'python-info-triple-quoted-string-p) | ||
| 6599 | start-pos)) | ||
| 6600 | (forward-char))))) | ||
| 6601 | |||
| 6602 | (ert-deftest python-info-triple-quoted-string-p-3 () | ||
| 6603 | "Test single quoted string." | ||
| 6604 | (python-tests-with-temp-buffer | ||
| 6605 | " | ||
| 6606 | s = 'Single' | ||
| 6607 | " | ||
| 6608 | (while (< (point) (point-max)) | ||
| 6609 | (should-not (python-tests-should-not-move | ||
| 6610 | #'python-info-triple-quoted-string-p)) | ||
| 6611 | (forward-char)))) | ||
| 6612 | |||
| 6494 | (ert-deftest python-info-encoding-from-cookie-1 () | 6613 | (ert-deftest python-info-encoding-from-cookie-1 () |
| 6495 | "Should detect it on first line." | 6614 | "Should detect it on first line." |
| 6496 | (python-tests-with-temp-buffer | 6615 | (python-tests-with-temp-buffer |