diff options
Diffstat (limited to 'tests/xapian.scm')
-rw-r--r-- | tests/xapian.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/xapian.scm b/tests/xapian.scm index fd339e1..93d1a64 100644 --- a/tests/xapian.scm +++ b/tests/xapian.scm @@ -1,5 +1,6 @@ ;;; guile-xapian --- Guile bindings for Xapian ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021 Bob131 <bob@bob131.so> ;;; ;;; This file is part of guile-xapian. ;;; @@ -22,4 +23,20 @@ (test-begin "xapian") +(let* ((invalid-utf8-data #vu8(#xf0 #x61 #x62 #x00)) + (binary-doc (make-document #:data invalid-utf8-data + #:values `((0 . ,invalid-utf8-data))))) + (test-error "document-data fails to decode binary data" + 'decoding-error + (document-data binary-doc)) + (test-equal "document-bytes reads binary data correctly" + invalid-utf8-data + (document-bytes binary-doc)) + (test-error "document-slot-ref fails to decode binary value" + 'decoding-error + (document-slot-ref binary-doc 0)) + (test-equal "document-slot-ref-bytes reads binary value correctly" + invalid-utf8-data + (document-slot-ref-bytes binary-doc 0))) + (test-end "xapian") |