diff --git a/test/test_main.cpp b/test/test_main.cpp index 8fc2cfe..c9f52e6 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -20,22 +20,20 @@ using namespace mstchtest; #define SPECS_TEST(x) TEST_CASE("specs_" #x) { \ using boost::get; \ - mstch::node data{json::parse(x ## _json)}; \ - for (auto& test_item: get(get(data)["tests"])) {\ + auto data = json::parse(x ## _json); \ + for(auto& test_item: get(get(data)["tests"])) {\ auto test = get(test_item); \ std::map partials; \ - if (test.count("partials")) \ - for (auto& partial_item: get(test["partials"])) \ + if(test.count("partials")) \ + for(auto& partial_item: get(test["partials"])) \ partials.insert(std::make_pair(partial_item.first, get(partial_item.second))); \ - mstch::map test_data; \ - for (auto& data_item: get(test["data"])) \ - if (data_item.first == "lambda") \ - test_data.insert(std::make_pair("lambda", specs_lambdas[get(test["name"])])); \ - else \ - test_data.insert(data_item); \ + for(auto& data_item: get(test["data"])) \ + if(data_item.first == "lambda") \ + data_item.second = specs_lambdas[get(test["name"])]; \ SECTION(get(test["name"])) \ - REQUIRE( \ - mstch::render(get(test["template"]), test_data, partials) == \ + REQUIRE(mstch::render( \ + get(test["template"]), \ + test["data"], partials) == \ get(test["expected"])); \ } \ }