mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Refactored parse.cpp so that VS doesn't complain, added MinSizeRel build setting, and fixed numbering in the spec tests
This commit is contained in:
@@ -113,6 +113,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||||
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
|
||||||
#
|
#
|
||||||
set(GCC_EXTRA_OPTIONS "")
|
set(GCC_EXTRA_OPTIONS "")
|
||||||
#
|
#
|
||||||
|
@@ -2155,8 +2155,8 @@ namespace Test {
|
|||||||
RunSpecTest(&Spec::BlockIndentationHeader, "8.2", "Block Indentation Header", passed, total);
|
RunSpecTest(&Spec::BlockIndentationHeader, "8.2", "Block Indentation Header", passed, total);
|
||||||
RunSpecTest(&Spec::InvalidBlockScalarIndentationIndicators, "8.3", "Invalid Block Scalar Indentation Indicators", passed, total);
|
RunSpecTest(&Spec::InvalidBlockScalarIndentationIndicators, "8.3", "Invalid Block Scalar Indentation Indicators", passed, total);
|
||||||
RunSpecTest(&Spec::ChompingFinalLineBreak, "8.4", "Chomping Final Line Break", passed, total);
|
RunSpecTest(&Spec::ChompingFinalLineBreak, "8.4", "Chomping Final Line Break", passed, total);
|
||||||
RunSpecTest(&Spec::ChompingTrailingLines, "8.4", "Chomping Trailing Lines", passed, total);
|
RunSpecTest(&Spec::ChompingTrailingLines, "8.5", "Chomping Trailing Lines", passed, total);
|
||||||
RunSpecTest(&Spec::EmptyScalarChomping, "8.4", "Empty Scalar Chomping", passed, total);
|
RunSpecTest(&Spec::EmptyScalarChomping, "8.6", "Empty Scalar Chomping", passed, total);
|
||||||
|
|
||||||
std::cout << "Spec tests: " << passed << "/" << total << " passed\n";
|
std::cout << "Spec tests: " << passed << "/" << total << " passed\n";
|
||||||
return passed == total;
|
return passed == total;
|
||||||
|
@@ -34,15 +34,8 @@ public:
|
|||||||
virtual void OnMapEnd() {}
|
virtual void OnMapEnd() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
void parse(std::istream& input)
|
||||||
{
|
{
|
||||||
Params p = ParseArgs(argc, argv);
|
|
||||||
|
|
||||||
std::ifstream fin;
|
|
||||||
if(argc > 1)
|
|
||||||
fin.open(argv[1]);
|
|
||||||
|
|
||||||
std::istream& input = (argc > 1 ? fin : std::cin);
|
|
||||||
try {
|
try {
|
||||||
YAML::Parser parser(input);
|
YAML::Parser parser(input);
|
||||||
YAML::Node doc;
|
YAML::Node doc;
|
||||||
@@ -55,5 +48,19 @@ int main(int argc, char **argv)
|
|||||||
} catch(const YAML::Exception& e) {
|
} catch(const YAML::Exception& e) {
|
||||||
std::cerr << e.what() << "\n";
|
std::cerr << e.what() << "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Params p = ParseArgs(argc, argv);
|
||||||
|
|
||||||
|
if(argc > 1) {
|
||||||
|
std::ifstream fin;
|
||||||
|
fin.open(argv[1]);
|
||||||
|
parse(fin);
|
||||||
|
} else {
|
||||||
|
parse(std::cin);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user