From 493acd119d730207524cd69fa25868c978bdf0f9 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 18 Feb 2015 10:45:40 +0100 Subject: Added test for bug with structs that do not posses a field --- test/formats/osml/OsmlParserTest.cpp | 14 ++++++++++++++ testdata/osmlparser/struct_with_no_field.osml | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 testdata/osmlparser/struct_with_no_field.osml diff --git a/test/formats/osml/OsmlParserTest.cpp b/test/formats/osml/OsmlParserTest.cpp index 3472e5f..4cda20a 100644 --- a/test/formats/osml/OsmlParserTest.cpp +++ b/test/formats/osml/OsmlParserTest.cpp @@ -158,5 +158,19 @@ TEST(OsmlParser, structureInheritance) ASSERT_TRUE(node != nullptr); ASSERT_TRUE(node->isa(&RttiTypes::Domain)); } + +TEST(OsmlParser, structWithNoField) +{ + OsmlStandaloneEnvironment env(logger); + logger.reset(); + + Rooted node = env.parse("struct_with_no_field.osml", "", "", + RttiSet{&RttiTypes::Node}); + ASSERT_FALSE(logger.hasError()); + + ASSERT_TRUE(node != nullptr); + ASSERT_TRUE(node->isa(&RttiTypes::Document)); +} + } diff --git a/testdata/osmlparser/struct_with_no_field.osml b/testdata/osmlparser/struct_with_no_field.osml new file mode 100644 index 0000000..8cf2d02 --- /dev/null +++ b/testdata/osmlparser/struct_with_no_field.osml @@ -0,0 +1,12 @@ +\document + +\domain#test + \struct#a[isRoot=true] + \field + \childRef[ref=b] + \struct#b + +\a + \b + \b + -- cgit v1.2.3