You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by mb...@apache.org on 2021/04/20 18:10:20 UTC
[daffodil] branch master updated: More tests from user examples.
This is an automated email from the ASF dual-hosted git repository.
mbeckerle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new a712c68 More tests from user examples.
a712c68 is described below
commit a712c68786fb9ba5dbdfa6cca7b30c6bd2fb2bd0
Author: Michael Beckerle <mb...@tresys.com>
AuthorDate: Tue Apr 20 12:56:03 2021 -0400
More tests from user examples.
DAFFODIL-2217
---
.../org/apache/daffodil/usertests/SepTests.tdml | 57 +++++++++++++++++++++-
.../apache/daffodil/usertests/TestSepTests.scala | 4 ++
2 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
index e207f08..d3a3955 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
@@ -23,8 +23,7 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ex="http://example.com"
- xmlns:fn="http://www.w3.org/2005/xpath-functions"
->
+ xmlns:fn="http://www.w3.org/2005/xpath-functions">
<tdml:defineSchema name="s1" elementFormDefault="unqualified">
@@ -115,4 +114,58 @@
</tdml:parserTestCase>
+ <tdml:defineSchema name="s2" elementFormDefault="unqualified">
+
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format
+ ref="ex:GeneralFormat"
+ representation="text"
+ lengthKind="delimited"
+ separatorPosition="infix" />
+
+ <!-- DAFFODIL-2217
+ These additional tests give another case where trailingEmptyStrict should be causing a
+ parse error, but it does not in a case where maxOccurs="3" but works correctly when maxOccurs="4".
+ -->
+
+ <!-- maxOccurs='3' fails to detect the trailing "/" i.e., this should fail with a parse error
+ due to trailingEmptyStrict -->
+
+ <xs:element name="file1">
+ <xs:complexType>
+ <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
+ dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="3" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- same, but maxOccurs is 4. This works, as in detects the error. -->
+ <xs:element name="file2">
+ <xs:complexType>
+ <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
+ dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="4" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="test_sep_trailingEmptyStrict_1" root="file1" model="s2">
+ <tdml:document>a/b/</tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>trailingEmptyStrict</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="test_sep_trailingEmptyStrict_2" root="file2" model="s2">
+ <tdml:document>a/b/</tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>trailingEmptyStrict</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
</tdml:testSuite>
\ No newline at end of file
diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
index 4b80658..170dfed 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
@@ -40,4 +40,8 @@ class TestSepTests {
// DAFFODIL-2498 anyEmpty with minOccurs '0', and empty as first occurrence.
@Test def test_sep_anyEmpty_2(): Unit = { runner.runOneTest("test_sep_anyEmpty_2") }
+ // DAFFODIL-2217 - trailingEmptyStrict violation not detected when maxOccurs is '3'
+ // @Test def test_sep_trailingEmptyStrict_1(): Unit = { runner.runOneTest("test_sep_trailingEmptyStrict_1") }
+ @Test def test_sep_trailingEmptyStrict_2(): Unit = { runner.runOneTest("test_sep_trailingEmptyStrict_2") }
+
}