summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2020-10-21 18:23:38 +0200
committerStefan Kangas <stefan@marxist.se>2020-10-22 14:55:57 +0200
commit0d7d09b0ef1b3a939422d273be2fa348e8a148c8 (patch)
tree37acc5a4e798eeffde91d497672f83f03333f0b4 /test/lisp/emacs-lisp
parent5215067c4efd186ffc0d8bf2e68bd4be7bf627c5 (diff)
downloademacs-0d7d09b0ef1b3a939422d273be2fa348e8a148c8.tar.gz
emacs-0d7d09b0ef1b3a939422d273be2fa348e8a148c8.tar.bz2
emacs-0d7d09b0ef1b3a939422d273be2fa348e8a148c8.zip
Test for error with multibyte strings in bindat.el
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test-pack/multibyte-string-fails) (bindat-test-unpack/multibyte-string-fails): New tests.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bindat-tests.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el
index 14f95a8bf80..0fb1955695d 100644
--- a/test/lisp/emacs-lisp/bindat-tests.el
+++ b/test/lisp/emacs-lisp/bindat-tests.el
@@ -1,4 +1,4 @@
-;;; bindat-tests.el --- tests for bindat.el -*- lexical-binding: t; -*-
+;;; bindat-tests.el --- tests for bindat.el -*- lexical-binding: t; coding: utf-8; -*-
;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
@@ -94,7 +94,13 @@
(src-ip .
[192 168 1 101])
(dest-ip .
- [192 168 1 100]))))))
+ [192 168 1 100]))))))
+
+(ert-deftest bindat-test-pack/multibyte-string-fails ()
+ (should-error (bindat-pack nil nil (decode-coding-string "ö" 'utf-8))))
+
+(ert-deftest bindat-test-unpack/multibyte-string-fails ()
+ (should-error (bindat-unpack nil (decode-coding-string "ö" 'utf-8))))
(ert-deftest bindat-test-format-vector ()
(should (equal (bindat-format-vector [1 2 3] "%d" "x" 2) "1x2"))