Skip to content

Commit cda1eb1

Browse files
committed
fix tests
1 parent fdb6a25 commit cda1eb1

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

libs/internal/tests/event_processor_test.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ TEST(WorkerPool, PoolReturnsNullptrWhenNoWorkerAvaialable) {
5959
ioc_thread.join();
6060
}
6161

62+
class EventProcessorTests : public ::testing::Test {
63+
public:
64+
EventProcessorTests() : locale("en_US.utf-8") {}
65+
std::locale locale;
66+
};
67+
6268
// This test is a temporary test that exists only to ensure the event processor
6369
// compiles; it should be replaced by more robust tests (and contract tests.)
64-
TEST(EventProcessorTests, ProcessorCompiles) {
70+
TEST_F(EventProcessorTests, ProcessorCompiles) {
6571
using namespace launchdarkly;
6672

6773
Logger logger{
@@ -95,33 +101,34 @@ TEST(EventProcessorTests, ProcessorCompiles) {
95101
ioc_thread.join();
96102
}
97103

98-
TEST(EventProcessorTests, ParseValidDateHeader) {
104+
TEST_F(EventProcessorTests, ParseValidDateHeader) {
99105
using namespace launchdarkly;
100106

101107
using Clock = std::chrono::system_clock;
102-
auto date = events::ParseDateHeader<Clock>("Wed, 21 Oct 2015 07:28:00 GMT");
108+
auto date =
109+
events::ParseDateHeader<Clock>("Wed, 21 Oct 2015 07:28:00 GMT", locale);
103110

104111
ASSERT_TRUE(date);
105112

106113
ASSERT_EQ(date->time_since_epoch(),
107114
std::chrono::microseconds(1445412480000000));
108115
}
109116

110-
TEST(EventProcessorTests, ParseInvalidDateHeader) {
117+
TEST_F(EventProcessorTests, ParseInvalidDateHeader) {
111118
using namespace launchdarkly;
112119

113120
auto not_a_date = events::ParseDateHeader<std::chrono::system_clock>(
114-
"this is definitely not a date");
121+
"this is definitely not a date", locale);
115122

116123
ASSERT_FALSE(not_a_date);
117124

118125
auto not_gmt = events::ParseDateHeader<std::chrono::system_clock>(
119-
"Wed, 21 Oct 2015 07:28:00 PST");
126+
"Wed, 21 Oct 2015 07:28:00 PST", locale);
120127

121128
ASSERT_FALSE(not_gmt);
122129

123130
auto missing_year = events::ParseDateHeader<std::chrono::system_clock>(
124-
"Wed, 21 Oct 07:28:00 GMT");
131+
"Wed, 21 Oct 07:28:00 GMT", locale);
125132

126133
ASSERT_FALSE(missing_year);
127134
}

0 commit comments

Comments
 (0)