summaryrefslogtreecommitdiff
path: root/test/src/coding-tests.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-04-05 11:27:36 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2020-04-05 11:39:52 +0200
commit962562cde45071f74a37854a299e88470a4ecd49 (patch)
tree730aa974d0aa77499d541e1d10812837ab1e7329 /test/src/coding-tests.el
parentbec5cfee7660f6e283efbd30a693a6f8e9ea46b8 (diff)
downloademacs-962562cde45071f74a37854a299e88470a4ecd49.tar.gz
Fix inverted NOCOPY encode/decode parameter (bug#40407)
In {encode,decode}-coding-string, the NOCOPY parameter had the opposite effect to what was intended and documented. This 18 year old bug (introduced in 4031e2bf0a) only affected calls with CODING-SYSTEM being nil. * src/coding.c (code_convert_string): Correct use of NOCOPY. * test/src/coding-tests.el (coding-nocopy-trivial): New test.
Diffstat (limited to 'test/src/coding-tests.el')
-rw-r--r--test/src/coding-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el
index 094a1fad8fa..110ff126964 100644
--- a/test/src/coding-tests.el
+++ b/test/src/coding-tests.el
@@ -375,6 +375,14 @@
(with-temp-buffer (insert-file-contents (car file))))))
(insert (format "%s: %s\n" (car file) result)))))))
+(ert-deftest coding-nocopy-trivial ()
+ "Check that the NOCOPY parameter works for the trivial coding system."
+ (let ((s "abc"))
+ (should-not (eq (decode-coding-string s nil nil) s))
+ (should (eq (decode-coding-string s nil t) s))
+ (should-not (eq (encode-coding-string s nil nil) s))
+ (should (eq (encode-coding-string s nil t) s))))
+
;; Local Variables:
;; byte-compile-warnings: (not obsolete)
;; End: