1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #15842 from TH3CHARLie:yaml-fix

* fix yaml parse

* add test for YAML parse multiple documents

* remove trailing whitespace in test
This commit is contained in:
TH3CHARLie
2019-11-04 21:27:48 +08:00
committed by Alexander Alekhin
parent 0d7f770996
commit a165f55579
2 changed files with 20 additions and 2 deletions
+19
View File
@@ -1640,4 +1640,23 @@ TEST(Core_InputOutput, FileStorage_free_file_after_exception)
ASSERT_EQ(0, std::remove(fileName.c_str()));
}
TEST(Core_InputOutput, FileStorage_YAML_parse_multiple_documents)
{
const std::string filename = "FileStorage_YAML_parse_multiple_documents.yml";
FileStorage fs;
fs.open(filename, FileStorage::WRITE);
fs << "a" << 42;
fs.release();
fs.open(filename, FileStorage::APPEND);
fs << "b" << 1988;
fs.release();
fs.open(filename, FileStorage::READ);
ASSERT_EQ(42, (int)fs["a"]);
ASSERT_EQ(1988, (int)fs["b"]);
fs.release();
}
}} // namespace