diff options
| author | Noam Postavsky <npostavs@gmail.com> | 2019-07-17 07:20:20 -0400 |
|---|---|---|
| committer | Noam Postavsky <npostavs@gmail.com> | 2019-07-20 21:35:21 -0400 |
| commit | 150bdfe43acde8423612cbff4eafbbb88878b497 (patch) | |
| tree | cde38dfb7a9bb330cb718ebd893876e7b15f8c7c /test/lisp/term-tests.el | |
| parent | 021f32cca1b9082e7219b06aee28c00c4323a72a (diff) | |
| download | emacs-150bdfe43acde8423612cbff4eafbbb88878b497.tar.gz | |
Handle completely undecoded input in term (Bug#29918)
* lisp/term.el (term-emulate-terminal): Avoid errors if the whole
decoded string is eight-bit characters. Don't attempt to save the
string for next iteration in that case.
* test/lisp/term-tests.el (term-decode-partial)
(term-undecodable-input): New tests.
Diffstat (limited to 'test/lisp/term-tests.el')
| -rw-r--r-- | test/lisp/term-tests.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index c2b90dea604..237e19d6b15 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -144,6 +144,25 @@ This is a reduced example from GNU nano's initial screen." `("\e[1;3r" "\e[2;1H" ,x "\r\e[1A" ,y)) (concat y "\n" x))))) +(ert-deftest term-decode-partial () ;; Bug#25288. + "Test multibyte characters sent into multiple chunks." + ;; Set `locale-coding-system' so test will be deterministic. + (let* ((locale-coding-system 'utf-8-unix) + (string (make-string 7 ?ш)) + (bytes (encode-coding-string string locale-coding-system))) + (should (equal string + (term-test-screen-from-input + 40 1 `(,(substring bytes 0 (/ (length bytes) 2)) + ,(substring bytes (/ (length bytes) 2)))))))) + +(ert-deftest term-undecodable-input () ;; Bug#29918. + "Undecodable bytes should be passed through without error." + (let* ((locale-coding-system 'utf-8-unix) ; As above. + (bytes "\376\340\360\370") + (string (decode-coding-string bytes locale-coding-system))) + (should (equal string + (term-test-screen-from-input + 40 1 bytes))))) (provide 'term-tests) |
