summaryrefslogtreecommitdiff
path: root/lib/Tie/File/12_longfetch_rs.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Tie/File/12_longfetch_rs.t')
-rw-r--r--lib/Tie/File/12_longfetch_rs.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Tie/File/12_longfetch_rs.t b/lib/Tie/File/12_longfetch_rs.t
new file mode 100644
index 0000000000..60f1fd1a50
--- /dev/null
+++ b/lib/Tie/File/12_longfetch_rs.t
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+#
+# Make sure we can fetch a record in the middle of the file
+# before we've ever looked at any records before it
+#
+# (tests _fill_offsets_to() )
+#
+
+my $file = "tf$$.txt";
+my $data = "rec0blahrec1blahrec2blah";
+
+print "1..5\n";
+
+my $N = 1;
+use Tie::File;
+print "ok $N\n"; $N++;
+
+open F, "> $file" or die $!;
+print F $data;
+close F;
+
+
+my $o = tie @a, 'Tie::File', $file, recsep => 'blah';
+print $o ? "ok $N\n" : "not ok $N\n";
+$N++;
+
+my $n;
+
+# 3-5
+for (2, 1, 0) {
+ print $a[$_] eq "rec${_}blah" ? "ok $N\n" : "not ok $N # rec=$a[$_] ?\n";
+ $N++;
+}
+
+END {
+ 1 while unlink $file;
+}
+