From 99c6f5df144d0530fe43225d353dee881cfdf26a Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 24 Jan 2015 13:23:55 +0100 Subject: Moved Terminal and TerminalLogger to own classes in new frontent folder --- test/core/common/LoggerTest.cpp | 81 ----------------------------------------- 1 file changed, 81 deletions(-) (limited to 'test/core/common/LoggerTest.cpp') diff --git a/test/core/common/LoggerTest.cpp b/test/core/common/LoggerTest.cpp index 7b0e6d0..67acc83 100644 --- a/test/core/common/LoggerTest.cpp +++ b/test/core/common/LoggerTest.cpp @@ -20,91 +20,10 @@ #include -#include #include -#include namespace ousia { -struct Pos { - SourceLocation pos; - Pos(SourceLocation pos = SourceLocation{}) : pos(pos){}; - - SourceLocation getLocation() { return pos; } -}; - -static const std::string testStr = - "\\link[domain]{book}\n" // 1 - "\\link[domain]{meta}\n" // 2 - "\n" // 3 - "\\meta{\n" // 4 - "\t\\title{The Adventures Of Tom Sawyer}\n" // 5 - "\t\\author{Mark Twain}\n" // 6 - "}\n" // 7 - "\n" // 8 - "\\book{\n" // 9 - "\n" // 10 - "\n" // 11 - "\\chapter\n" // 12 - "<>\n" // 13 - "\n" // 14 - "No answer.\n" // 15 - "\n" // 16 - "<>\n" // 17 - "\n" // 18 - "No answer.\n" // 19 - "\n" // 20 - "<>\n" // 21 - "}\n"; // 22 - -static SourceContextReader contextReader{}; - -static SourceContext contextCallback(const SourceLocation &location) -{ - CharReader reader{testStr, 0}; - return contextReader.readContext(reader, location, 60, - "the_adventures_of_tom_sawyer.opd"); -} - -TEST(TerminalLogger, log) -{ - // Test for manual visual expection only -- no assertions - TerminalLogger logger{std::cerr, true}; - logger.setSourceContextCallback(contextCallback); - - logger.debug("This is a test debug message"); - logger.note("This is a test note"); - logger.note("This is a test note with point context", SourceLocation{0, 49}); - logger.note("This is a test note with range context", SourceLocation{0, 49, 55}); - logger.note("This is a test note with multiline context", SourceLocation{0, 49, 150}); - logger.warning("This is a test warning"); - logger.error("This is a test error"); - logger.fatalError("This is a test fatal error!"); - - logger.error("This is a test error with context"); - - try { - throw LoggableException{"An exception"}; - } - catch (const LoggableException &ex) { - logger.log(ex); - } -} - -TEST(TerminalLogger, fork) -{ - // Test for manual visual expection only -- no assertions - TerminalLogger logger{std::cerr, true}; - - logger.setSourceContextCallback(contextCallback); - - LoggerFork fork = logger.fork(); - - fork.error("This is a test error with context"); - - // Print all error messages - fork.commit(); -} } -- cgit v1.2.3