diff --git a/test/specs_lambdas.hpp b/test/specs_lambdas.hpp index 13bf4ca..87ebd5f 100644 --- a/test/specs_lambdas.hpp +++ b/test/specs_lambdas.hpp @@ -1,26 +1,26 @@ -std::map> specs_lambdas { - {"Interpolation", [](const std::string&) { +std::map specs_lambdas { + {"Interpolation", mstch::lambda{[](const std::string&) -> mstch::node { return std::string{"world"}; - }}, - {"Interpolation - Expansion", [](const std::string&) { + }}}, + {"Interpolation - Expansion", mstch::lambda{[](const std::string&) -> mstch::node { 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; - }}, - {"Escaping", [](const std::string&) { + }}}, + {"Escaping", mstch::lambda{[](const std::string&) -> mstch::node { return std::string{">"}; - }}, - {"Section", [](const std::string& txt) { + }}}, + {"Section", mstch::lambda{[](const std::string& txt) -> mstch::node { 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; - }}, - {"Section - Multiple Calls", [](const std::string& txt) { + }}}, + {"Section - Multiple Calls", mstch::lambda{[](const std::string& txt) -> mstch::node { return "__" + txt + "__"; - }}, - {"Inverted Section", [](const std::string& txt) { + }}}, + {"Inverted Section", mstch::lambda{[](const std::string& txt) -> mstch::node { return false; - }} + }}} }; \ No newline at end of file diff --git a/test/test_main.cpp b/test/test_main.cpp index b73823b..f83c407 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -28,7 +28,7 @@ using namespace mstchtest; partials.insert(std::make_pair(partial_item.first, get(partial_item.second))); \ for(auto& data_item: get(test["data"])) \ if(data_item.first == "lambda") \ - data_item.second = mstch::lambda(specs_lambdas[get(test["name"])]); \ + data_item.second = specs_lambdas[get(test["name"])]; \ SECTION(get(test["name"])) \ REQUIRE(mstch::render( \ get(test["template"]), \