diff options
-rw-r--r-- | test/core/parser/stack/StackTest.cpp | 3 | ||||
-rw-r--r-- | test/formats/osml/OsmlParserTest.cpp | 14 | ||||
-rw-r--r-- | test/formats/osxml/OsxmlEventParserTest.cpp | 4 | ||||
-rw-r--r-- | test/formats/osxml/OsxmlParserTest.cpp | 15 | ||||
-rw-r--r-- | testdata/osmlparser/simple_annotation.osml | 17 | ||||
-rw-r--r-- | testdata/osxmlparser/simple_annotation.osxml | 9 |
6 files changed, 58 insertions, 4 deletions
diff --git a/test/core/parser/stack/StackTest.cpp b/test/core/parser/stack/StackTest.cpp index a831c32..af2b8e8 100644 --- a/test/core/parser/stack/StackTest.cpp +++ b/test/core/parser/stack/StackTest.cpp @@ -144,8 +144,7 @@ public: return tracker.startCommandResult; } - bool startAnnotation(Variant::mapType &args, - AnnotationType annotationType) override + bool startAnnotation(Variant::mapType &args) override { tracker.startAnnotationArgs = args; tracker.startAnnotationCount++; diff --git a/test/formats/osml/OsmlParserTest.cpp b/test/formats/osml/OsmlParserTest.cpp index c88232b..1c8894d 100644 --- a/test/formats/osml/OsmlParserTest.cpp +++ b/test/formats/osml/OsmlParserTest.cpp @@ -199,5 +199,19 @@ TEST(OsmlParser, explicitFields) ASSERT_TRUE(node->isa(&RttiTypes::Document)); } +TEST(OsmlParser, simpleAnnotation) +{ + OsmlStandaloneEnvironment env(logger); + logger.reset(); + + Rooted<Node> node = env.parse("simple_annotation.osml", "", "", + RttiSet{&RttiTypes::Node}); + ASSERT_FALSE(logger.hasError()); + + ASSERT_TRUE(node != nullptr); + ASSERT_TRUE(node->isa(&RttiTypes::Document)); +} + + } diff --git a/test/formats/osxml/OsxmlEventParserTest.cpp b/test/formats/osxml/OsxmlEventParserTest.cpp index d4e9443..6e1dddf 100644 --- a/test/formats/osxml/OsxmlEventParserTest.cpp +++ b/test/formats/osxml/OsxmlEventParserTest.cpp @@ -58,10 +58,10 @@ public: } void annotationEnd(const Variant &className, - const Variant &elementName) override + const Variant::mapType &args) override { events.emplace_back(OsxmlEvent::ANNOTATION_END, - Variant::arrayType{className, elementName}); + Variant::arrayType{className, args}); } void rangeEnd() override diff --git a/test/formats/osxml/OsxmlParserTest.cpp b/test/formats/osxml/OsxmlParserTest.cpp index 79dd58b..03f10d3 100644 --- a/test/formats/osxml/OsxmlParserTest.cpp +++ b/test/formats/osxml/OsxmlParserTest.cpp @@ -399,5 +399,20 @@ TEST(OsxmlParser, complexDocumentParsing) ASSERT_FALSE(logger.hasError()); } +TEST(OsxmlParser, simpleAnnotation) +{ + logger.reset(); + XmlStandaloneEnvironment env(logger); + Rooted<Node> book_document_node = + env.parse("simple_annotation.osxml", "", "", RttiSet{&RttiTypes::Document}); + ASSERT_FALSE(logger.hasError()); + ASSERT_FALSE(book_document_node == nullptr); + ASSERT_TRUE(book_document_node->isa(&RttiTypes::Document)); + Rooted<Document> doc = book_document_node.cast<Document>(); + ASSERT_TRUE(doc->validate(logger)); + ASSERT_FALSE(logger.hasError()); +} + + } diff --git a/testdata/osmlparser/simple_annotation.osml b/testdata/osmlparser/simple_annotation.osml new file mode 100644 index 0000000..55e1c08 --- /dev/null +++ b/testdata/osmlparser/simple_annotation.osml @@ -0,0 +1,17 @@ +\begin{document} + +\ontology#testOntology + \struct#test[root=true] + \field + \childRef[ref=a] + \struct#a[transparent=true] + \primitive[type=string] + \annotation#comment + \primitive[type=string] + +\begin{test} +This is a <\comment{Not a nice test!}test\> for annotations. +\end{test} + +\end{document} + diff --git a/testdata/osxmlparser/simple_annotation.osxml b/testdata/osxmlparser/simple_annotation.osxml new file mode 100644 index 0000000..7eb1713 --- /dev/null +++ b/testdata/osxmlparser/simple_annotation.osxml @@ -0,0 +1,9 @@ +<document> + <import rel="ontology" src="./book_ontology.osxml"/> + <import rel="ontology" src="./comments_ontology.osxml"/> + + <book> + This is a <a:start:comment>This is not a nice test!</a:start:comment>test<a:end:comment/>. + </book> +</document> + |