Commit d2fe1ace authored by Paul Novotny's avatar Paul Novotny

Fix failing unit tests, update version number

When building as a shared library, one of the unit tests was failing.
Specifically, it was writing out the nodes in a different order than the
test expected. Since the order isn't defined, the test was actually
fine. So we check if the node is written out in one of two possible
orders.

Also, gmock and gtest were linked the to unit tests. Running the unit
tests when yaml-cpp was built as a shared library caused a free of
already deallocated memory.  This was fixed by only linking against
gmock.
parent 2f097146
yaml-cpp (0.5.1-2) UNRELEASED; urgency=medium
yaml-cpp (0.5.1+hg20150210-1) UNRELEASED; urgency=medium
* Import latest upstream
* Fix failing unit tests
* Inject package into collab-maint to enable more people contributing
* cme fix dpkg-control
* debhelper 9
......
--- a/test/node/node_test.cpp
+++ b/test/node/node_test.cpp
@@ -363,8 +363,13 @@
blockNode["scalar"] = 1.01;
blockNode["object"] = mapNode;
- ExpectOutput("scalar: 1.01\nobject: {position: [1.01, 2.01, 3.01]}",
- blockNode);
+ Emitter emitter;
+ emitter << blockNode;
+
+ ASSERT_TRUE(emitter.good());
+ std::string output1 = "scalar: 1.01\nobject: {position: [1.01, 2.01, 3.01]}";
+ std::string output2 = "object: {position: [1.01, 2.01, 3.01]}\nscalar: 1.01";
+ EXPECT_TRUE(output1 == emitter.c_str() || output2 == emitter.c_str());
}
TEST_F(NodeEmitterTest, NestBlockMapListNode) {
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -29,6 +29,6 @@
set_target_properties(run-tests PROPERTIES
COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags} ${yaml_test_flags}"
)
-target_link_libraries(run-tests yaml-cpp gtest gmock)
+target_link_libraries(run-tests yaml-cpp gmock)
add_test(yaml-test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/run-tests)
pkgconfig.patch
fix-unit-test.patch
remove-conflicting-google-libs.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment