summaryrefslogtreecommitdiff
path: root/compiler/hermes-std/src/ConsoleReporter.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/hermes-std/src/ConsoleReporter.test.cpp')
-rw-r--r--compiler/hermes-std/src/ConsoleReporter.test.cpp170
1 files changed, 167 insertions, 3 deletions
diff --git a/compiler/hermes-std/src/ConsoleReporter.test.cpp b/compiler/hermes-std/src/ConsoleReporter.test.cpp
index c2e1f1c85..d959ff3d9 100644
--- a/compiler/hermes-std/src/ConsoleReporter.test.cpp
+++ b/compiler/hermes-std/src/ConsoleReporter.test.cpp
@@ -16,8 +16,7 @@
#include "hermes/ConsoleReporter.h"
-#include <stdex/Memory.h>
-
+#include <memory>
#include <sstream>
#include <gtest/gtest.h>
@@ -37,7 +36,172 @@ TEST(ConsoleReporterTest, notify)
ss << "Hello" << std::endl;
- m.text(stdex::make_unique<hermes::MessageText>(ss));
+ m.text(std::make_unique<hermes::MessageText>(ss));
+ }
+
+ hermes::ConsoleReporter r;
+
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_fatal)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is colored as FATAL" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::FATAL);
+ }
+
+ hermes::ConsoleReporter r;
+
+ r.set_colored_mode(true);
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_error)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is colored as ERROR" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::ERROR);
+ }
+
+ hermes::ConsoleReporter r;
+
+ r.set_colored_mode(true);
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_warn)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is colored as WARN" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::WARN);
+ }
+
+ hermes::ConsoleReporter r;
+
+ r.set_colored_mode(true);
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_info)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is colored as INFO" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::INFO);
+ }
+
+ hermes::ConsoleReporter r;
+
+ r.set_colored_mode(true);
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_verbose)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is colored as VERBOSE" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::VERBOSE);
+ }
+
+ hermes::ConsoleReporter r;
+
+ r.set_colored_mode(true);
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_fatal_NEG)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is not colored as FATAL" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::FATAL);
+ }
+
+ hermes::ConsoleReporter r;
+
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_error_NEG)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is not colored as ERROR" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::ERROR);
+ }
+
+ hermes::ConsoleReporter r;
+
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_warn_NEG)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is not colored as WARN" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::WARN);
+ }
+
+ hermes::ConsoleReporter r;
+
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_info_NEG)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is not colored as INFO" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::INFO);
+ }
+
+ hermes::ConsoleReporter r;
+
+ ASSERT_NO_THROW(r.notify(&m));
+}
+
+TEST(ConsoleReporterTest, notify_verbose_NEG)
+{
+ hermes::Message m;
+ {
+ std::stringstream ss;
+
+ ss << "This message is not colored as VERBOSE" << std::endl;
+
+ m.text(std::make_unique<hermes::MessageText>(ss), hermes::VERBOSE);
}
hermes::ConsoleReporter r;