summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/test/classtype.ice1
-rw-r--r--slicer/test/initial/optionals-areset.xml8
-rw-r--r--slicer/test/initial/seqOfClass.xml8
-rw-r--r--slicer/test/serializers.cpp10
-rw-r--r--slicer/tool/parser.cpp9
5 files changed, 23 insertions, 13 deletions
diff --git a/slicer/test/classtype.ice b/slicer/test/classtype.ice
index 54f4d45..cf4be61 100644
--- a/slicer/test/classtype.ice
+++ b/slicer/test/classtype.ice
@@ -8,6 +8,7 @@ module TestModule {
int a;
int b;
};
+ ["slicer:element:bis"]
sequence<ClassType> Classes;
};
diff --git a/slicer/test/initial/optionals-areset.xml b/slicer/test/initial/optionals-areset.xml
index 54cf855..400e379 100644
--- a/slicer/test/initial/optionals-areset.xml
+++ b/slicer/test/initial/optionals-areset.xml
@@ -10,14 +10,14 @@
<date>2017-09-07</date>
</optClass>
<optSeq>
- <element>
+ <bis>
<a>3</a>
<b>4</b>
- </element>
- <element>
+ </bis>
+ <bis>
<a>5</a>
<b>6</b>
- </element>
+ </bis>
</optSeq>
<optDict>
<element>
diff --git a/slicer/test/initial/seqOfClass.xml b/slicer/test/initial/seqOfClass.xml
index 0ed2ccf..f36c599 100644
--- a/slicer/test/initial/seqOfClass.xml
+++ b/slicer/test/initial/seqOfClass.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Classes>
- <element>
+ <bis>
<a>1</a>
<b>2</b>
- </element>
- <element>
+ </bis>
+ <bis>
<a>4</a>
<b>5</b>
- </element>
+ </bis>
</Classes>
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 83080df..b161e7f 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -714,6 +714,16 @@ BOOST_AUTO_TEST_CASE(DeserializeXmlAbstractImpl)
BOOST_CHECK_EQUAL("value", impl->testVal);
}
+BOOST_AUTO_TEST_CASE(DeserializeXmlIncorrectSeqElementName)
+{
+ std::stringstream in(R"X(
+ <Classes>
+ <obj/>
+ </Classes>)X");
+ BOOST_CHECK_THROW((Slicer::DeserializeAny<Slicer::XmlStreamDeserializer, TestModule::BuiltInSeq>(in)),
+ Slicer::IncorrectElementName);
+}
+
BOOST_AUTO_TEST_CASE(customerModelPartCounters)
{
BOOST_REQUIRE_EQUAL(21, TestModule::completions);
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index 9e9e65e..ef468e8 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -494,12 +494,12 @@ namespace Slicer {
"bool matchCase)\n{\n",
s->scoped());
const IceMetaData md {s->getMetaData()};
- auto iname = md.value("slicer:item:");
- if (iname) {
+ auto ename = md.value("slicer:element:");
+ if (ename) {
fprintbf(cpp,
"\tif (!name.empty() && !optionalCaseEq(name, \"%s\", matchCase)) { throw "
- "IncorrectElementName(name); }\n",
- *iname);
+ "IncorrectElementName(std::string{name}); }\n",
+ *ename);
}
else {
fprintbf(cpp, "\t(void)matchCase;\n");
@@ -508,7 +508,6 @@ namespace Slicer {
fprintbf(cpp, "\treturn GetAnonChildRef(flt);\n}\n\n");
fprintbf(cpp, "template<> DLL_PUBLIC\n");
- auto ename = md.value("slicer:element:");
fprintbf(cpp, "const std::string ModelPartForSequence< %s >::elementName(\"%s\");\n\n", s->scoped(),
ename ? *ename : "element");