aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 7681c72..ce8fdb2 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -1,5 +1,5 @@
;;; guile-email --- Guile email parser
-;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of guile-email.
;;;
@@ -35,4 +35,15 @@
(call-with-input-string ""
(cut read-while <> read identity))))
+(test-equal "read-bytes-till returns empty bytevector on match at beginning"
+ (call-with-port (open-bytevector-input-port #vu8(1 2 3))
+ (cut read-bytes-till <> #vu8(1 2)))
+ #vu8())
+
+(test-equal "read-while returns empty string on match at beginning"
+ (call-with-input-string "foo\nbar"
+ (lambda (port)
+ (read-while port get-line (negate (cut string-prefix? "foo" <>)))))
+ "")
+
(test-end "utils")