| 1 |
#include <pbcopper/cli2/internal/VersionPrinter.h> |
| 2 |
|
| 3 |
#include <sstream> |
| 4 |
#include <string> |
| 5 |
|
| 6 |
#include <gtest/gtest.h> |
| 7 |
|
| 8 |
#include <pbcopper/cli2/Interface.h> |
| 9 |
#include <pbcopper/cli2/MultiToolInterface.h> |
| 10 |
|
| 11 |
using namespace PacBio; |
| 12 |
|
| 13 |
TEST(CLI2_VersionPrinter, prints_application_name_and_version) |
| 14 |
{ |
| 15 |
const CLI_v2::Interface i{"frobber", "Frob all the things", "2.0"}; |
| 16 |
const std::string expectedText{"frobber 2.0\n"}; |
| 17 |
|
| 18 |
std::ostringstream out; |
| 19 |
CLI_v2::internal::VersionPrinter::Print(i, out); |
| 20 |
EXPECT_EQ(expectedText, out.str()); |
| 21 |
} |
| 22 |
|
| 23 |
TEST(CLI2_VersionPrinter, prints_multitool_name_and_version) |
| 24 |
{ |
| 25 |
const CLI_v2::MultiToolInterface i{"frobber", "Frob all the things", "2.0"}; |
| 26 |
const std::string expectedText{"frobber 2.0\n"}; |
| 27 |
|
| 28 |
std::ostringstream out; |
| 29 |
CLI_v2::internal::VersionPrinter::Print(i, out); |
| 30 |
EXPECT_EQ(expectedText, out.str()); |
| 31 |
} |