]> git.eshelyaron.com Git - emacs.git/commitdiff
Test for error with multibyte strings in bindat.el
authorStefan Kangas <stefan@marxist.se>
Wed, 21 Oct 2020 16:23:38 +0000 (18:23 +0200)
committerStefan Kangas <stefan@marxist.se>
Thu, 22 Oct 2020 12:55:57 +0000 (14:55 +0200)
* test/lisp/emacs-lisp/bindat-tests.el
(bindat-test-pack/multibyte-string-fails)
(bindat-test-unpack/multibyte-string-fails): New tests.

test/lisp/emacs-lisp/bindat-tests.el

index 14f95a8bf80b2e69a24ce6f124e8cfd23d6ddfcc..0fb1955695d98f7ac308cd95306174dafae60519 100644 (file)
@@ -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.
 
               (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"))