MSVC2013 workarounds

This commit is contained in:
Daniel Sipka 2015-10-01 12:40:51 +02:00
parent cefdfba10f
commit 1365c6f804
2 changed files with 18 additions and 18 deletions

View file

@ -1,26 +1,26 @@
std::map<std::string,std::function<mstch::node(const std::string&)>> specs_lambdas { std::map<std::string,mstch::node> specs_lambdas {
{"Interpolation", [](const std::string&) { {"Interpolation", mstch::lambda{[](const std::string&) -> mstch::node {
return std::string{"world"}; return std::string{"world"};
}}, }}},
{"Interpolation - Expansion", [](const std::string&) { {"Interpolation - Expansion", mstch::lambda{[](const std::string&) -> mstch::node {
return std::string{"{{planet}}"}; return std::string{"{{planet}}"};
}}, }}},
{"Interpolation - Multiple Calls", [](const std::string&) { {"Interpolation - Multiple Calls", mstch::lambda{[](const std::string&) -> mstch::node {
static int calls = 0; return ++calls; static int calls = 0; return ++calls;
}}, }}},
{"Escaping", [](const std::string&) { {"Escaping", mstch::lambda{[](const std::string&) -> mstch::node {
return std::string{">"}; return std::string{">"};
}}, }}},
{"Section", [](const std::string& txt) { {"Section", mstch::lambda{[](const std::string& txt) -> mstch::node {
return std::string{(txt == "{{x}}") ? "yes" : "no"}; return std::string{(txt == "{{x}}") ? "yes" : "no"};
}}, }}},
{"Section - Expansion", [](const std::string& txt) { {"Section - Expansion", mstch::lambda{[](const std::string& txt) -> mstch::node {
return txt + std::string{"{{planet}}"} + txt; return txt + std::string{"{{planet}}"} + txt;
}}, }}},
{"Section - Multiple Calls", [](const std::string& txt) { {"Section - Multiple Calls", mstch::lambda{[](const std::string& txt) -> mstch::node {
return "__" + txt + "__"; return "__" + txt + "__";
}}, }}},
{"Inverted Section", [](const std::string& txt) { {"Inverted Section", mstch::lambda{[](const std::string& txt) -> mstch::node {
return false; return false;
}} }}}
}; };

View file

@ -28,7 +28,7 @@ using namespace mstchtest;
partials.insert(std::make_pair(partial_item.first, get<std::string>(partial_item.second))); \ partials.insert(std::make_pair(partial_item.first, get<std::string>(partial_item.second))); \
for(auto& data_item: get<mstch::map>(test["data"])) \ for(auto& data_item: get<mstch::map>(test["data"])) \
if(data_item.first == "lambda") \ if(data_item.first == "lambda") \
data_item.second = mstch::lambda(specs_lambdas[get<std::string>(test["name"])]); \ data_item.second = specs_lambdas[get<std::string>(test["name"])]; \
SECTION(get<std::string>(test["name"])) \ SECTION(get<std::string>(test["name"])) \
REQUIRE(mstch::render( \ REQUIRE(mstch::render( \
get<std::string>(test["template"]), \ get<std::string>(test["template"]), \