diff --git a/src/utils/Console.h b/src/utils/Console.h index 7412f812..68410db1 100644 --- a/src/utils/Console.h +++ b/src/utils/Console.h @@ -17,8 +17,6 @@ public: IOStreamConsole(); IOStreamConsole(std::ostream &output, std::istream &input); unsigned int ask(const std::string &question, const std::vector &options) override; - - //TODO Test print() void print(const std::string &output) override; private: std::ostream &_output; diff --git a/test/utils/ConsoleTest.cpp b/test/utils/ConsoleTest.cpp index b3811dd9..e2ea2e8e 100644 --- a/test/utils/ConsoleTest.cpp +++ b/test/utils/ConsoleTest.cpp @@ -22,6 +22,9 @@ public: return _console.ask(question, options); }); } + void print(const string &output) { + _console.print(output); + } private: IOStreamConsole _console; }; @@ -55,6 +58,10 @@ public: return _console.ask(question, options); } + void print(const string &output) { + _console.print(output); + } + private: cpputils::pipestream _inputStr; cpputils::pipestream _outputStr; @@ -238,4 +245,9 @@ TEST_F(ConsoleTest, InputNonNumbers) { EXPECT_OUTPUT_LINE("Your choice [1-2]", ':', " "); sendInputLine("2"); EXPECT_EQ(1, chosen.get()); +} + +TEST_F(ConsoleTest, TestPrint) { + print("Bla Blub"); + EXPECT_OUTPUT_LINE("Bla Blu", 'b'); // 'b' is the delimiter for reading } \ No newline at end of file