about summary refs log tree commit homepage
path: root/t/search.t
diff options
context:
space:
mode:
Diffstat (limited to 't/search.t')
-rw-r--r--t/search.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/search.t b/t/search.t
index d4ca28c7..82caf9e4 100644
--- a/t/search.t
+++ b/t/search.t
@@ -59,6 +59,14 @@ sub oct_is ($$$) {
         }
 }
 
+{
+        my $crlf_adjust = \&PublicInbox::SearchIdx::crlf_adjust;
+        is($crlf_adjust->("hi\r\nworld\r\n"), 0, 'no adjustment needed');
+        is($crlf_adjust->("hi\nworld\n"), 2, 'LF-only counts two CR');
+        is($crlf_adjust->("hi\r\nworld\n"), 1, 'CRLF/LF-mix 1 counts 1 CR');
+        is($crlf_adjust->("hi\nworld\r\n"), 1, 'CRLF/LF-mix 2 counts 1 CR');
+}
+
 $ibx->with_umask(sub {
         my $root = PublicInbox::Eml->new(<<'EOF');
 Date: Fri, 02 Oct 1993 00:00:00 +0000