Skip to content

Commit

Permalink
Adapt zimcheck -version test
Browse files Browse the repository at this point in the history
  • Loading branch information
kelson42 committed Jan 3, 2022
1 parent 43cfb7b commit 6f5c3ba
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/zimcheck-test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#include <sstream>

#include "gtest/gtest.h"

#include "zim/zim.h"
#include "zim/archive.h"
#include "../src/zimcheck/checks.h"

std::string getLine(std::string str) {
std::istringstream f(str);
std::string line;
std::getline(f, line);
return line;
}

TEST(zimfilechecks, test_checksum)
{
Expand Down Expand Up @@ -172,20 +180,22 @@ TEST(zimcheck, help)

TEST(zimcheck, version)
{
std::string version = "zim-tools " + std::string(VERSION);

{
CapturedStdout zimcheck_output;
ASSERT_EQ(0, zimcheck({"zimcheck", "-v"}));
ASSERT_EQ(std::string(VERSION) + "\n", std::string(zimcheck_output));
ASSERT_EQ(version, getLine(std::string(zimcheck_output)));
}
{
CapturedStdout zimcheck_output;
ASSERT_EQ(0, zimcheck({"zimcheck", "-V"}));
ASSERT_EQ(std::string(VERSION) + "\n", std::string(zimcheck_output));
ASSERT_EQ(version, getLine(std::string(zimcheck_output)));
}
{
CapturedStdout zimcheck_output;
ASSERT_EQ(0, zimcheck({"zimcheck", "--version"}));
ASSERT_EQ(std::string(VERSION) + "\n", std::string(zimcheck_output));
ASSERT_EQ(version, getLine(std::string(zimcheck_output)));
}
}

Expand Down

0 comments on commit 6f5c3ba

Please sign in to comment.