osx const error fix

This commit is contained in:
Daniel Sipka 2015-10-12 10:48:11 +02:00
parent d9cdc3a35f
commit 96a65e43d6

View file

@ -20,22 +20,22 @@ using namespace mstchtest;
#define SPECS_TEST(x) TEST_CASE("specs_" #x) { \ #define SPECS_TEST(x) TEST_CASE("specs_" #x) { \
using boost::get; \ using boost::get; \
auto data = json::parse<mstch::node,mstch::map,mstch::array>(x ## _json); \ mstch::node data = json::parse<mstch::node,mstch::map,mstch::array>(x ## _json); \
for (auto& test_item: get<mstch::array>(get<mstch::map>(data)["tests"])) {\ for (auto& test_item: get<mstch::array>(get<mstch::map>(data)["tests"])) {\
auto test = get<mstch::map>(test_item); \ auto test = get<mstch::map>(test_item); \
std::map<std::string,std::string> partials; \ std::map<std::string,std::string> partials; \
if (test.count("partials")) \ if (test.count("partials")) \
for (auto& partial_item: get<mstch::map>(test["partials"])) \ for (auto& partial_item: get<mstch::map>(test["partials"])) \
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))); \
mstch::map data; \ mstch::map test_data; \
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.insert(std::make_pair("lambda", specs_lambdas[get<std::string>(test["name"])])); \ test_data.insert(std::make_pair("lambda", specs_lambdas[get<std::string>(test["name"])])); \
else \ else \
data.insert(data_item); \ test_data.insert(data_item); \
SECTION(get<std::string>(test["name"])) \ SECTION(get<std::string>(test["name"])) \
REQUIRE( \ REQUIRE( \
mstch::render(get<std::string>(test["template"]), data, partials) == \ mstch::render(get<std::string>(test["template"]), test_data, partials) == \
get<std::string>(test["expected"])); \ get<std::string>(test["expected"])); \
} \ } \
} }