mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Add ifdef to check if BOOST_FOREACH is defined, and disable tests that use it if it is not available
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
#include "nodetests.h"
|
#include "nodetests.h"
|
||||||
#include "yaml-cpp/yaml.h"
|
#include "yaml-cpp/yaml.h"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
|
#if BOOST_VERSION >= 103400
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct TEST {
|
struct TEST {
|
||||||
TEST(): ok(false) {}
|
TEST(): ok(false) {}
|
||||||
@@ -383,6 +388,7 @@ namespace Test
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_FOREACH
|
||||||
TEST ForEach()
|
TEST ForEach()
|
||||||
{
|
{
|
||||||
YAML::Node node = YAML::Load("[1, 3, 5, 7]");
|
YAML::Node node = YAML::Load("[1, 3, 5, 7]");
|
||||||
@@ -403,6 +409,7 @@ namespace Test
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST CloneScalar()
|
TEST CloneScalar()
|
||||||
{
|
{
|
||||||
@@ -568,8 +575,10 @@ namespace Test
|
|||||||
RunNodeTest(&Node::Binary, "binary", passed, total);
|
RunNodeTest(&Node::Binary, "binary", passed, total);
|
||||||
RunNodeTest(&Node::IterateSequence, "iterate sequence", passed, total);
|
RunNodeTest(&Node::IterateSequence, "iterate sequence", passed, total);
|
||||||
RunNodeTest(&Node::IterateMap, "iterate map", passed, total);
|
RunNodeTest(&Node::IterateMap, "iterate map", passed, total);
|
||||||
|
#ifdef BOOST_FOREACH
|
||||||
RunNodeTest(&Node::ForEach, "for each", passed, total);
|
RunNodeTest(&Node::ForEach, "for each", passed, total);
|
||||||
RunNodeTest(&Node::ForEachMap, "for each map", passed, total);
|
RunNodeTest(&Node::ForEachMap, "for each map", passed, total);
|
||||||
|
#endif
|
||||||
RunNodeTest(&Node::CloneScalar, "clone scalar", passed, total);
|
RunNodeTest(&Node::CloneScalar, "clone scalar", passed, total);
|
||||||
RunNodeTest(&Node::CloneSeq, "clone seq", passed, total);
|
RunNodeTest(&Node::CloneSeq, "clone seq", passed, total);
|
||||||
RunNodeTest(&Node::CloneMap, "clone map", passed, total);
|
RunNodeTest(&Node::CloneMap, "clone map", passed, total);
|
||||||
|
Reference in New Issue
Block a user