class TestItem: public pkgAcquire::Item
{
public:
- TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq) {}
+ explicit TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq) {}
- virtual std::string DescURI() const { return ""; }
- virtual HashStringList GetExpectedHashes() const { return HashStringList(); }
+ virtual std::string DescURI() const APT_OVERRIDE { return ""; }
+ virtual HashStringList GetExpectedHashes() const APT_OVERRIDE { return HashStringList(); }
};
AcqTextStatus Stat(out, width, 0);
Stat.Start();
+ pkgAcquire Acq(&Stat);
pkgAcquire::ItemDesc hit;
hit.URI = "http://example.org/file";
hit.Description = "Example File from example.org";
hit.ShortDesc = "Example File";
- hit.Owner = NULL;
+ TestItem hitO(&Acq);
+ hit.Owner = &hitO;
EXPECT_EQ("", out.str());
Stat.IMSHit(hit);
- EXPECT_EQ("Hit Example File from example.org\n", out.str());
+ EXPECT_EQ("Hit:1 Example File from example.org\n", out.str());
Stat.IMSHit(hit);
- EXPECT_EQ("Hit Example File from example.org\n"
- "Hit Example File from example.org\n", out.str());
+ EXPECT_EQ("Hit:1 Example File from example.org\n"
+ "Hit:1 Example File from example.org\n", out.str());
Stat.Stop();
- EXPECT_EQ("Hit Example File from example.org\n"
- "Hit Example File from example.org\n", out.str());
+ EXPECT_EQ("Hit:1 Example File from example.org\n"
+ "Hit:1 Example File from example.org\n", out.str());
}
TEST(AcqProgress, FetchNoFileSize)
{
EXPECT_EQ("Get:1 Example File from example.org\n", out.str());
Stat.Fetch(fetch);
EXPECT_EQ("Get:1 Example File from example.org\n"
- "Get:2 Example File from example.org\n", out.str());
+ "Get:1 Example File from example.org\n", out.str());
Stat.Stop();
EXPECT_EQ("Get:1 Example File from example.org\n"
- "Get:2 Example File from example.org\n", out.str());
+ "Get:1 Example File from example.org\n", out.str());
}
TEST(AcqProgress, FetchFileSize)
{
fetchO.FileSize = 42;
Stat.Fetch(fetch);
EXPECT_EQ("Get:1 Example File from example.org [100 B]\n"
- "Get:2 Example File from example.org [42 B]\n", out.str());
+ "Get:1 Example File from example.org [42 B]\n", out.str());
Stat.Stop();
EXPECT_EQ("Get:1 Example File from example.org [100 B]\n"
- "Get:2 Example File from example.org [42 B]\n", out.str());
+ "Get:1 Example File from example.org [42 B]\n", out.str());
}
TEST(AcqProgress, Fail)
{
EXPECT_EQ("", out.str());
Stat.Fail(fetch);
- EXPECT_EQ("", out.str());
+ EXPECT_EQ("Ign:1 Example File from example.org\n", out.str());
fetchO.Status = pkgAcquire::Item::StatDone;
Stat.Fail(fetch);
- EXPECT_EQ("Ign Example File from example.org\n", out.str());
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n", out.str());
fetchO.Status = pkgAcquire::Item::StatError;
fetchO.ErrorText = "An error test!";
Stat.Fail(fetch);
- EXPECT_EQ("Ign Example File from example.org\n"
- "Err Example File from example.org\n"
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
" An error test!\n", out.str());
_config->Set("Acquire::Progress::Ignore::ShowErrorText", true);
fetchO.Status = pkgAcquire::Item::StatDone;
Stat.Fail(fetch);
- EXPECT_EQ("Ign Example File from example.org\n"
- "Err Example File from example.org\n"
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
" An error test!\n"
- "Ign Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
" An error test!\n", out.str());
_config->Set("Acquire::Progress::Ignore::ShowErrorText", true);
Stat.Stop();
- EXPECT_EQ("Ign Example File from example.org\n"
- "Err Example File from example.org\n"
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
" An error test!\n"
- "Ign Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
" An error test!\n", out.str());
}
TEST(AcqProgress, Pulse)