Fix clang and MSVC 2017 build with C++17 enabled
parent
a5c6c167a5
commit
e89ed39582
|
@ -1,5 +1,6 @@
|
|||
BasedOnStyle: Mozilla
|
||||
IndentWidth: 4
|
||||
TabWidth: 8
|
||||
ColumnLimit: 160
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
|
|
|
@ -671,22 +671,6 @@ public:
|
|||
: ptr( std::move( value ) )
|
||||
{}
|
||||
|
||||
template< class... Args
|
||||
nsvp_REQUIRES_T(
|
||||
std::is_constructible<T, Args&&...>::value )
|
||||
>
|
||||
explicit value_ptr( nonstd_lite_in_place_t(T), Args&&... args )
|
||||
: ptr( nonstd_lite_in_place(T), std::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
template< class U, class... Args
|
||||
nsvp_REQUIRES_T(
|
||||
std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value )
|
||||
>
|
||||
explicit value_ptr( nonstd_lite_in_place_t(T), std::initializer_list<U> il, Args&&... args )
|
||||
: ptr( nonstd_lite_in_place(T), il, std::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
#endif // nsvp_CPP11_OR_GREATER
|
||||
|
||||
explicit value_ptr( cloner_type const & cloner )
|
||||
|
|
|
@ -166,7 +166,7 @@ https://google.com?label1label1label1#someTarget
|
|||
|
||||
TEST(UserCallableTestSingle, ReflectedCallable)
|
||||
{
|
||||
std::string source = R"(
|
||||
std::string source = R"(
|
||||
{% set callable = reflected.basicCallable %}{{ callable() }}
|
||||
{{ reflected.basicCallable() }}
|
||||
{% set inner = reflected.getInnerStruct() %}{{ inner.strValue }}
|
||||
|
@ -174,39 +174,39 @@ TEST(UserCallableTestSingle, ReflectedCallable)
|
|||
{{ innerReflected.strValue }}
|
||||
)";
|
||||
|
||||
Template tpl;
|
||||
auto parseRes = tpl.Load(source);
|
||||
EXPECT_TRUE(parseRes.has_value());
|
||||
if (!parseRes)
|
||||
{
|
||||
std::cout << parseRes.error() << std::endl;
|
||||
return;
|
||||
}
|
||||
Template tpl;
|
||||
auto parseRes = tpl.Load(source);
|
||||
EXPECT_TRUE(parseRes.has_value());
|
||||
if (!parseRes)
|
||||
{
|
||||
std::cout << parseRes.error() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
TestStruct reflected;
|
||||
auto innerReflected = std::make_shared<TestInnerStruct>();
|
||||
innerReflected->strValue = "!!Hello World!!";
|
||||
reflected.intValue = 100500;
|
||||
reflected.innerStruct = std::make_shared<TestInnerStruct>();
|
||||
reflected.innerStruct->strValue = "Hello World!";
|
||||
{
|
||||
jinja2::ValuesMap params;
|
||||
params["reflected"] = jinja2::Reflect(reflected);
|
||||
params["innerReflected"] = jinja2::Reflect(innerReflected);
|
||||
TestStruct reflected;
|
||||
auto innerReflected = std::make_shared<TestInnerStruct>();
|
||||
innerReflected->strValue = "!!Hello World!!";
|
||||
reflected.intValue = 100500;
|
||||
reflected.innerStruct = std::make_shared<TestInnerStruct>();
|
||||
reflected.innerStruct->strValue = "Hello World!";
|
||||
{
|
||||
jinja2::ValuesMap params;
|
||||
params["reflected"] = jinja2::Reflect(reflected);
|
||||
params["innerReflected"] = jinja2::Reflect(innerReflected);
|
||||
|
||||
std::string result = tpl.RenderAsString(params).value();
|
||||
std::cout << result << std::endl;
|
||||
std::string expectedResult = R"(
|
||||
std::string result = tpl.RenderAsString(params).value();
|
||||
std::cout << result << std::endl;
|
||||
std::string expectedResult = R"(
|
||||
100500
|
||||
100500
|
||||
Hello World!
|
||||
Hello World!
|
||||
!!Hello World!!
|
||||
)";
|
||||
EXPECT_EQ(expectedResult, result);
|
||||
}
|
||||
EXPECT_EQ(1L, innerReflected.use_count());
|
||||
EXPECT_EQ(1L, reflected.innerStruct.use_count());
|
||||
EXPECT_EQ(expectedResult, result);
|
||||
}
|
||||
EXPECT_EQ(1L, innerReflected.use_count());
|
||||
EXPECT_EQ(1L, reflected.innerStruct.use_count());
|
||||
}
|
||||
|
||||
struct UserCallableParamConvertTestTag;
|
||||
|
@ -255,12 +255,10 @@ TEST_P(UserCallableFilterTest, Test)
|
|||
|
||||
jinja2::ValuesMap params = PrepareTestData();
|
||||
|
||||
params["surround"] = MakeCallable(
|
||||
[](const std::string& val, const std::string& before, const std::string& after) {return before + val + after;},
|
||||
ArgInfo{"val"},
|
||||
ArgInfo{"before", false, ">>> "},
|
||||
ArgInfo{"after", false, " <<<"}
|
||||
);
|
||||
params["surround"] = MakeCallable([](const std::string& val, const std::string& before, const std::string& after) { return before + val + after; },
|
||||
ArgInfoT<const std::string&>{ "val" },
|
||||
ArgInfoT<const std::string&>{ "before", false, ">>> " },
|
||||
ArgInfoT<const std::string&>{ "after", false, " <<<" });
|
||||
params["joiner"] = MakeCallable([](const std::string& delim, const ValuesList& items) {
|
||||
std::ostringstream os;
|
||||
bool isFirst = true;
|
||||
|
|
Loading…
Reference in New Issue