From 9c6bba3dfd8bf16cf1db6c34347088141f3e68bd Mon Sep 17 00:00:00 2001 From: Daniel Sipka Date: Mon, 12 Oct 2015 10:39:54 +0200 Subject: [PATCH] osx const error fix --- test/test_main.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/test_main.cpp b/test/test_main.cpp index f1cb236..11f36ed 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -21,19 +21,21 @@ using namespace mstchtest; #define SPECS_TEST(x) TEST_CASE("specs_" #x) { \ using boost::get; \ auto data = json::parse(x ## _json); \ - for(auto& test_item: get(get(data)["tests"])) {\ + 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))); \ - for(std::pair& data_item: get(test["data"])) \ - if(data_item.first == "lambda") \ - data_item.second = specs_lambdas[get(test["name"])]; \ + mstch::map data; \ + for (auto& data_item: get(test["data"])) \ + if (data_item.first == "lambda") \ + data.insert(std::make_pair("lambda", specs_lambdas[get(test["name"])])); \ + else \ + data.insert(data_item); \ SECTION(get(test["name"])) \ - REQUIRE(mstch::render( \ - get(test["template"]), \ - test["data"], partials) == \ + REQUIRE( \ + mstch::render(get(test["template"]), data, partials) == \ get(test["expected"])); \ } \ }