Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
odygrd committed Aug 15, 2020
1 parent 6b2fba5 commit 63a5aa7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion quill/test/QuillLogTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ TEST_CASE("invalid_handlers")
// try to use console colours with stdout handler as name
quill::ConsoleColours terminal_colours;
terminal_colours.set_default_colours();
REQUIRE_THROWS_AS(quill::stdout_handler("stdout", terminal_colours), quill::QuillError);
REQUIRE_THROWS_AS(auto x5 = quill::stdout_handler("stdout", terminal_colours), quill::QuillError);

// remove file
#if defined(_WIN32)
Expand Down
30 changes: 18 additions & 12 deletions quill/test/TimeRotatingFileHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,74 @@ TEST_SUITE_BEGIN("TimeRotatingFileHandler");
using namespace quill::detail;
using namespace quill;

#if defined(_WIN32)
static filename_t const filename{L"test_time_rotating_file_handler.log"};
#else
static filename_t const filename{"test_time_rotating_file_handler.log"};
#endif

#ifndef QUILL_NO_EXCEPTIONS
TEST_CASE("construct_invalid_when")
{
std::string const when = "S";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", when, 1, 1, Timezone::LocalTime, "12:00"});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", when, 1, 1, Timezone::LocalTime, "12:00"});
}

TEST_CASE("construct_invalid_at_time")
{
{
std::string const at_time = "25:00";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "125:00";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "5:00";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "0:00";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = ":00";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "01:000";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "01:0";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "01:";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "0";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "a";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}

{
std::string const at_time = "a:b";
REQUIRE_THROWS(TimeRotatingFileHandler{"test", "a", "daily", 1, 1, Timezone::LocalTime, at_time});
REQUIRE_THROWS(TimeRotatingFileHandler{filename, "a", "daily", 1, 1, Timezone::LocalTime, at_time});
}
}
#endif
Expand Down

0 comments on commit 63a5aa7

Please sign in to comment.