diff options
author | Julian Andres Klode <jak@debian.org> | 2016-02-10 13:29:19 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-02-10 13:31:12 +0100 |
commit | 5fafaf27a5f066dc15d96c03ef154fd1d59eb891 (patch) | |
tree | c17265399480b315e427c9489c26209e3c93d3c9 /test/libapt | |
parent | b6f1b480164b454661ddd4fdd3968302c6a3ebf6 (diff) |
test that seeking to a position earlier in the file works
This tests the fix for #812994, #813000
Gbp-Dch: ignore
Diffstat (limited to 'test/libapt')
-rw-r--r-- | test/libapt/fileutl_test.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 7d1368f7a..607c4a195 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -82,6 +82,18 @@ static void TestFileFd(mode_t const a_umask, mode_t const ExpectedFilePermission EXPECT_N_STR(expect, readback); EXPECT_EQ(test.size(), f.Tell()); } + // Non-zero backwards seek + { + APT_INIT_READBACK + char const * const expect = "is"; + EXPECT_EQ(test.size(), f.Tell()); + EXPECT_TRUE(f.Seek(5)); + EXPECT_TRUE(f.Read(readback, strlen(expect))); + EXPECT_FALSE(f.Failed()); + EXPECT_FALSE(f.Eof()); + EXPECT_N_STR(expect, readback); + EXPECT_EQ(7, f.Tell()); + } { APT_INIT_READBACK EXPECT_TRUE(f.Seek(0)); |