]> git.saurik.com Git - apt.git/commitdiff
test that seeking to a position earlier in the file works
authorJulian Andres Klode <jak@debian.org>
Wed, 10 Feb 2016 12:29:19 +0000 (13:29 +0100)
committerJulian Andres Klode <jak@debian.org>
Wed, 10 Feb 2016 12:31:12 +0000 (13:31 +0100)
This tests the fix for #812994, #813000

Gbp-Dch: ignore

test/libapt/fileutl_test.cc

index 7d1368f7a491fae0a1a83e6e58cb92609d26551a..607c4a195bbae2361267d96e11b1a32c6864c67e 100644 (file)
@@ -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));