aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPo Lu2024-09-11 13:21:58 +0800
committerPo Lu2024-09-11 13:21:58 +0800
commit76487b7454b88557d7c8dec7136b7a09aacfb5bf (patch)
tree842ee1c5078c962b39f227608fca99ddf9d1ccd3 /test
parent652a8a0838b38a6eab85c55fc61cedd1c61ef20f (diff)
parentee3e3a6311196129104881d6e9097bb54d8843af (diff)
downloademacs-76487b7454b88557d7c8dec7136b7a09aacfb5bf.tar.gz
emacs-76487b7454b88557d7c8dec7136b7a09aacfb5bf.zip
Merge from savannah/emacs-30
ee3e3a63111 ; Update version number of exec/configure.ac c5925b6ba5f Fix heex-ts-mode indentation following previews elixir-mo... c3383be5f04 ; * admin/make-tarball.txt: Improve last change. 8ddb54117f1 ; * admin/make-tarball.txt: Remove now unnecessary config... 7e194d33f90 * lisp/ldefs-boot.el: Update. 9019536ea66 Fix use of Uniscribe font driver in MinGW build 5c55c860db7 Avoid crashes in redisplay in batch-mode testing ba2190e1ae7 ; * etc/NEWS: Fix indentation. 818c0cc9a51 eglot-test-rust-completion-exit-function: Fix failure in ... f47297782bd ; * doc/lispref/searching.texi (Rx Notation): Simplify rx... 03e56981675 Clarify the semantics of 'string-pixel-width' 9f0603207b1 ; * src/treesit.c: Minor cleanups of recent changes. e0d3f743957 * src/treesit.c (treesit_debug_print_parser_list): Fix fo... bed38ded730 ; * src/treesit.c (treesit_debug_print_parser_list): Fix ... 18c6487dbd0 ; * src/treesit.c: Add a prototype so there's no warning ... bf23382f1f2 Read more on each call to treesit's buffer reader 3435464452b Fix the range handling in treesit.c 3fcec09f754 Add debugging function for treesit.c 0fd259d166c Fix elixir-ts-mode's range query 2329b36b1fb ; project-files-relative-names: Update docstring (bug#72701) e55e2e1c6ba Make json-serialize always return a unibyte string (bug#7... 89c99891b2b ; * doc/lispref/os.texi (Suspending Emacs): Fix last change. 4f044d0d3df ; Improve documentation of 'suspend-emacs'
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/eglot-tests.el10
-rw-r--r--test/src/json-tests.el50
2 files changed, 32 insertions, 28 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index c0e30172482..eaef990d5ea 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -136,9 +136,11 @@ directory hierarchy."
136 (jsonrpc-events-buffer server))))) 136 (jsonrpc-events-buffer server)))))
137 (cond (noninteractive 137 (cond (noninteractive
138 (dolist (buffer buffers) 138 (dolist (buffer buffers)
139 (eglot--test-message "contents of `%s':" (buffer-name buffer)) 139 (eglot--test-message "contents of `%s' %S:" (buffer-name buffer) buffer)
140 (princ (with-current-buffer buffer (buffer-string)) 140 (if (buffer-live-p buffer)
141 'external-debugging-output))) 141 (princ (with-current-buffer buffer (buffer-string))
142 'external-debugging-output)
143 (princ "Killed\n" #'external-debugging-output))))
142 (t 144 (t
143 (eglot--test-message "Preserved for inspection: %s" 145 (eglot--test-message "Preserved for inspection: %s"
144 (mapconcat #'buffer-name buffers ", ")))))))) 146 (mapconcat #'buffer-name buffers ", "))))))))
@@ -724,7 +726,7 @@ directory hierarchy."
724 (minibuffer-choose-completion t)) 726 (minibuffer-choose-completion t))
725 (should 727 (should
726 (equal 728 (equal
727 "fn test() -> i32 { let v: usize = 1; v.count_ones().1234567890;" 729 "fn test() -> i32 { let v: usize = 1; v.count_ones.1234567890;"
728 (buffer-string)))))) 730 (buffer-string))))))
729 731
730(ert-deftest eglot-test-basic-xref () 732(ert-deftest eglot-test-basic-xref ()
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index ebac70fb1c7..1d7491a4593 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -36,7 +36,7 @@
36 (json 36 (json
37 "[null,false,true,0,123,-456,3.75,\"abc\uFFFFαβγ𝔸𝐁𝖢\\\"\\\\\"]") 37 "[null,false,true,0,123,-456,3.75,\"abc\uFFFFαβγ𝔸𝐁𝖢\\\"\\\\\"]")
38 (json-bytes (encode-coding-string json 'utf-8))) 38 (json-bytes (encode-coding-string json 'utf-8)))
39 (should (equal (json-serialize lisp) json)) ; or `json-bytes'? 39 (should (equal (json-serialize lisp) json-bytes))
40 (with-temp-buffer 40 (with-temp-buffer
41 ;; multibyte buffer 41 ;; multibyte buffer
42 (json-insert lisp) 42 (json-insert lisp)
@@ -82,28 +82,29 @@
82 "\"abc\uFFFFαβγ𝔸𝐁𝖢\\\"\\\\\""))) 82 "\"abc\uFFFFαβγ𝔸𝐁𝖢\\\"\\\\\"")))
83 (cl-destructuring-bind (lisp json) case 83 (cl-destructuring-bind (lisp json) case
84 (ert-info ((format "%S ↔ %S" lisp json)) 84 (ert-info ((format "%S ↔ %S" lisp json))
85 (should (equal (json-serialize lisp) json)) 85 (let ((json-bytes (encode-coding-string json 'utf-8)))
86 (with-temp-buffer 86 (should (equal (json-serialize lisp) json-bytes))
87 (json-insert lisp) 87 (with-temp-buffer
88 (should (equal (buffer-string) json)) 88 (json-insert lisp)
89 (should (eobp))) 89 (should (equal (buffer-string) json))
90 (with-temp-buffer 90 (should (eobp)))
91 (set-buffer-multibyte nil) 91 (with-temp-buffer
92 (json-insert lisp) 92 (set-buffer-multibyte nil)
93 (should (equal (buffer-string) (encode-coding-string json 'utf-8))) 93 (json-insert lisp)
94 (should (eobp))) 94 (should (equal (buffer-string) (encode-coding-string json 'utf-8)))
95 (should (equal (json-parse-string json) lisp)) 95 (should (eobp)))
96 (with-temp-buffer 96 (should (equal (json-parse-string json) lisp))
97 (insert json) 97 (with-temp-buffer
98 (goto-char 1) 98 (insert json)
99 (should (equal (json-parse-buffer) lisp)) 99 (goto-char 1)
100 (should (eobp))) 100 (should (equal (json-parse-buffer) lisp))
101 (with-temp-buffer 101 (should (eobp)))
102 (set-buffer-multibyte nil) 102 (with-temp-buffer
103 (insert (encode-coding-string json 'utf-8)) 103 (set-buffer-multibyte nil)
104 (goto-char 1) 104 (insert (encode-coding-string json 'utf-8))
105 (should (equal (json-parse-buffer) lisp)) 105 (goto-char 1)
106 (should (eobp))))))) 106 (should (equal (json-parse-buffer) lisp))
107 (should (eobp))))))))
107 108
108(ert-deftest json-serialize/object () 109(ert-deftest json-serialize/object ()
109 (let ((table (make-hash-table :test #'equal))) 110 (let ((table (make-hash-table :test #'equal)))
@@ -226,7 +227,8 @@
226 (should (equal (json-serialize ["foo"]) "[\"foo\"]")) 227 (should (equal (json-serialize ["foo"]) "[\"foo\"]"))
227 (should (equal (json-serialize ["a\n\fb"]) "[\"a\\n\\fb\"]")) 228 (should (equal (json-serialize ["a\n\fb"]) "[\"a\\n\\fb\"]"))
228 (should (equal (json-serialize ["\nasdфыв\u001f\u007ffgh\t"]) 229 (should (equal (json-serialize ["\nasdфыв\u001f\u007ffgh\t"])
229 "[\"\\nasdфыв\\u001F\u007ffgh\\t\"]")) 230 (encode-coding-string "[\"\\nasdфыв\\u001F\u007ffgh\\t\"]"
231 'utf-8)))
230 (should (equal (json-serialize ["a\0b"]) "[\"a\\u0000b\"]")) 232 (should (equal (json-serialize ["a\0b"]) "[\"a\\u0000b\"]"))
231 (should-error (json-serialize ["\xC3\x84"])) 233 (should-error (json-serialize ["\xC3\x84"]))
232 (should-error (json-serialize ["\u00C4\xC3\x84"]))) 234 (should-error (json-serialize ["\u00C4\xC3\x84"])))