summaryrefslogtreecommitdiff
path: root/test/core/common/LoggerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/common/LoggerTest.cpp')
-rw-r--r--test/core/common/LoggerTest.cpp81
1 files changed, 0 insertions, 81 deletions
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 <gtest/gtest.h>
-#include <core/common/CharReader.hpp>
#include <core/common/Logger.hpp>
-#include <core/common/SourceContextReader.hpp>
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
- "<<TOM!>>\n" // 13
- "\n" // 14
- "No answer.\n" // 15
- "\n" // 16
- "<<TOM!>>\n" // 17
- "\n" // 18
- "No answer.\n" // 19
- "\n" // 20
- "<<What's gone with that boy, I wonder? You TOM!>>\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();
-}
}