mstch/test/specs_lambdas.hpp

26 lines
893 B
C++
Raw Normal View History

2015-05-05 20:15:47 +08:00
std::map<std::string,std::function<mstch::node(const std::string&)>> specs_lambdas {
2015-05-04 22:14:32 +08:00
{"Interpolation", [](const std::string&) {
2015-05-05 20:15:47 +08:00
return std::string{"world"};
2015-05-04 22:14:32 +08:00
}},
{"Interpolation - Expansion", [](const std::string&) {
2015-05-05 20:15:47 +08:00
return std::string{"{{planet}}"};
2015-05-04 22:14:32 +08:00
}},
{"Interpolation - Multiple Calls", [](const std::string&) {
2015-05-05 20:15:47 +08:00
static int calls = 0; return ++calls;
2015-05-04 22:14:32 +08:00
}},
{"Escaping", [](const std::string&) {
2015-05-05 20:15:47 +08:00
return std::string{">"};
2015-05-04 22:14:32 +08:00
}},
{"Section", [](const std::string& txt) {
2015-05-05 20:15:47 +08:00
return std::string{(txt == "{{x}}") ? "yes" : "no"};
2015-05-04 22:14:32 +08:00
}},
{"Section - Expansion", [](const std::string& txt) {
2015-05-05 20:15:47 +08:00
return txt + std::string{"{{planet}}"} + txt;
2015-05-04 22:14:32 +08:00
}},
{"Section - Multiple Calls", [](const std::string& txt) {
return "__" + txt + "__";
}},
{"Inverted Section", [](const std::string& txt) {
2015-05-05 20:15:47 +08:00
return false;
2015-05-04 22:14:32 +08:00
}}
};