mirror of
https://github.com/vgough/encfs.git
synced 2024-11-29 03:15:07 +01:00
5f0806c5cc
git-vendor-name: easylogging git-vendor-dir: vendor/github.com/muflihun/easyloggingpp git-vendor-repository: https://github.com/muflihun/easyloggingpp git-vendor-ref: master
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
#ifndef CUSTOM_FORMAT_SPECIFIER_TEST_H
|
|
#define CUSTOM_FORMAT_SPECIFIER_TEST_H
|
|
|
|
#include "test.h"
|
|
|
|
const char* getIp(const el::LogMessage*) {
|
|
return "127.0.0.1";
|
|
}
|
|
|
|
TEST(CustomFormatSpecifierTest, TestInstall) {
|
|
EXPECT_FALSE(el::Helpers::hasCustomFormatSpecifier("%ip"));
|
|
el::Helpers::installCustomFormatSpecifier(el::CustomFormatSpecifier("%ip", getIp));
|
|
EXPECT_TRUE(el::Helpers::hasCustomFormatSpecifier("%ip"));
|
|
}
|
|
|
|
TEST(CustomFormatSpecifierTest, TestResolution) {
|
|
Configurations c;
|
|
c.setGlobally(el::ConfigurationType::Format, "%datetime{%a %b %d, %H:%m} %ip: %msg");
|
|
el::Loggers::reconfigureLogger(consts::kDefaultLoggerId, c);
|
|
LOG(INFO) << "My ip test";
|
|
std::string s = BUILD_STR(getDate() << " 127.0.0.1: My ip test\n");
|
|
EXPECT_EQ(s, tail(1));
|
|
// Reset back
|
|
reconfigureLoggersForTest();
|
|
}
|
|
|
|
TEST(CustomFormatSpecifierTest, TestUnInstall) {
|
|
EXPECT_TRUE(el::Helpers::hasCustomFormatSpecifier("%ip"));
|
|
el::Helpers::uninstallCustomFormatSpecifier("%ip");
|
|
EXPECT_FALSE(el::Helpers::hasCustomFormatSpecifier("%ip"));
|
|
}
|
|
|
|
#endif // CUSTOM_FORMAT_SPECIFIER_TEST_H
|