35 "Not used, but should still be in the list");
41 "Test that multi-token type names can be used");
54 }
else if (value ==
"b") {
57 throw std::runtime_error(
"Invalid value passed to UserDefinedType ctor");
69 template <
class String>
73 }
else if (t.
value_ == 100) {
76 throw std::runtime_error(
"Can't convert UserDefinedType to string");
85 "User defined type constructed from string");
89 TEST(Settings, user_defined) {
162 auto res = sn.
getAsString(
"follytest_public_flag_to_a");
170 const auto& md = meta.value();
179 const auto& md = meta.value();
187 auto res = sn.
getAsString(
"follytest_nonexisting");
193 sn.
setFromString(
"follytest_public_flag_to_a",
"300",
"from_string"));
200 auto res = sn.
getAsString(
"follytest_public_flag_to_a");
208 sn.
setFromString(
"follytest_nonexisting",
"300",
"from_string"));
228 if (meta.
typeId ==
typeid(
int)) {
229 EXPECT_EQ(meta.typeStr,
"int");
231 EXPECT_EQ(meta.typeStr,
"std::string");
232 }
else if (meta.
typeId ==
typeid(
unsigned int)) {
233 EXPECT_EQ(meta.typeStr,
"unsigned int");
235 EXPECT_EQ(meta.typeStr,
"UserDefinedType");
240 "{}/{}/{}/{}/{}/{}/{}\n",
251 "follytest/internal_flag_to_a/int/789/Desc of int/789/default\n" 252 "follytest/internal_flag_to_b/std::string/\"test\"/Desc of str/test/default\n" 253 "follytest/multi_token_type/unsigned int/123/Test that multi-token type names can be used/123/default\n" 254 "follytest/public_flag_to_a/int/456/Public flag to a/300/from_string\n" 255 "follytest/public_flag_to_b/std::string/\"basdf\"/Public flag to b/basdf/default\n" 256 "follytest/some_flag/std::string/\"default\"/Description/default/default\n" 257 "follytest/unused/std::string/\"unused_default\"/Not used, but should still be in the list/unused_default/default\n" 258 "follytest/user_defined/UserDefinedType/\"b\"/User defined type constructed from string/b_out/default\n");
290 .set(
"snapshot_value");
309 .set(
"snapshot_value2");
UserDefinedType(folly::StringPiece value)
bool setFromString(StringPiece settingName, StringPiece newValue, StringPiece reason) override
void toAppend(const UserDefinedType &t, String *out)
#define EXPECT_THROW(statement, expected_exception)
std::string sformat(StringPiece fmt, Args &&...args)
#define EXPECT_EQ(val1, val2)
constexpr auto size(C const &c) -> decltype(c.size())
FOLLY_SETTING_DEFINE(follytest, some_flag, std::string,"default","Description")
void setRemote(int value)
void forEachSetting(const std::function< void(const SettingMetadata &, StringPiece, StringPiece)> &func) const override
static const char *const value
if(FOLLY_USE_SYMBOLIZER) add_library(folly_exception_tracer_base ExceptionTracer.cpp StackTrace.cpp) apply_folly_compile_options_to_target(folly_exception_tracer_base) target_link_libraries(folly_exception_tracer_base PUBLIC folly) add_library(folly_exception_tracer ExceptionStackTraceLib.cpp ExceptionTracerLib.cpp) apply_folly_compile_options_to_target(folly_exception_tracer) target_link_libraries(folly_exception_tracer PUBLIC folly_exception_tracer_base) add_library(folly_exception_counter ExceptionCounterLib.cpp) apply_folly_compile_options_to_target(folly_exception_counter) target_link_libraries(folly_exception_counter PUBLIC folly_exception_tracer) install(FILES ExceptionAbi.h ExceptionCounterLib.h ExceptionTracer.h ExceptionTracerLib.h StackTrace.h DESTINATION $
#define FOLLY_SETTING(_project, _name)
Optional< SettingMetadata > getSettingsMeta(StringPiece settingName)
#define EXPECT_TRUE(condition)
Optional< SettingsInfo > getAsString(StringPiece settingName) const override
bool operator==(const UserDefinedType &other) const
#define EXPECT_FALSE(condition)
bool resetToDefault(StringPiece settingName) override
TEST(Settings, user_defined)