This is an automated email from the ASF dual-hosted git repository.
olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new ef1c78870 Verify overlap check doesn't occur with default format
ef1c78870 is described below
commit ef1c7887016b4703375fa20a8b05e418716333f3
Author: olabusayoT <[email protected]>
AuthorDate: Tue Nov 12 19:10:19 2024 -0500
Verify overlap check doesn't occur with default format
- add test for verification
DAFFODIL-1842
---
.../section07/property_syntax/PropertySyntax.tdml | 42 ++++++++++++++++++++++
.../property_syntax_overlap1.dfdl.xsd | 35 ++++++++++++++++++
.../property_syntax_overlap2.dfdl.xsd | 42 ++++++++++++++++++++++
.../property_syntax/TestPropertySyntax.scala | 7 ++++
4 files changed, 126 insertions(+)
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/PropertySyntax.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/PropertySyntax.tdml
index 4ff560d87..49005e121 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/PropertySyntax.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/PropertySyntax.tdml
@@ -359,4 +359,46 @@
</tdml:infoset>
</tdml:parserTestCase>
+ <tdml:parserTestCase name="overlappingProperties1" root="outer"
roundTrip="onePass"
+
model="/org/apache/daffodil/section07/property_syntax/property_syntax_overlap2.dfdl.xsd"
+ ignoreUnexpectedWarnings="false">
+ <tdml:document>hello</tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <outer>
+ <e1>hello</e1>
+ </outer>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:defineSchema name="PropertySyntaxOverlap">
+
+ <xs:include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"
+ lengthUnits="bytes" encoding="UTF-8" separator="" initiator=""
+ terminator="" occursCountKind="parsed" ignoreCase="no"
+ textNumberRep="standard" representation="text" initiatedContent="no" />
+
+ <xs:element name="e1" type="xs:string" dfdl:lengthUnits="bits"/>
+
+ <xs:element name="outer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ex:e1" dfdl:lengthUnits="bytes"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="overlappingProperties2" root="outer"
roundTrip="onePass"
+ model="PropertySyntaxOverlap"
+ ignoreUnexpectedWarnings="false">
+ <tdml:document>hello</tdml:document>
+ <tdml:errors>
+ <tdml:error>Overlap is not allowed</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
</tdml:testSuite>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap1.dfdl.xsd
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap1.dfdl.xsd
new file mode 100644
index 000000000..4454005a5
--- /dev/null
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap1.dfdl.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+targetNamespace="urn:overlap1" xmlns:o1="urn:overlap1">
+
+ <xs:include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+
+ <xs:annotation>
+ <xs:appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:format ref="o1:GeneralFormat" lengthKind="delimited"
+ lengthUnits="bytes" encoding="UTF-8" separator="" initiator=""
+ terminator="" occursCountKind="parsed" ignoreCase="no"
+ textNumberRep="standard" representation="text" initiatedContent="no"
/>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:element name="e1" type="xs:string"/>
+
+</xs:schema>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap2.dfdl.xsd
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap2.dfdl.xsd
new file mode 100644
index 000000000..dcf0ba335
--- /dev/null
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section07/property_syntax/property_syntax_overlap2.dfdl.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+targetNamespace="urn:overlap2" xmlns:o1="urn:overlap1" xmlns:o2="urn:overlap2">
+
+ <xs:include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <xs:import namespace="urn:overlap1"
schemaLocation="/org/apache/daffodil/section07/property_syntax/property_syntax_overlap1.dfdl.xsd"/>
+
+ <xs:annotation>
+ <xs:appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:format ref="o2:GeneralFormat" lengthKind="delimited"
+ lengthUnits="bits" encoding="UTF-8" separator="" initiator=""
+ terminator="" occursCountKind="parsed" ignoreCase="no"
+ textNumberRep="standard" representation="text" initiatedContent="no"
/>
+ </xs:appinfo>
+ </xs:annotation>
+
+ <xs:element name="outer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="o1:e1" dfdl:lengthUnits="characters" dfdl:length="5"
dfdl:lengthKind="explicit"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/section07/property_syntax/TestPropertySyntax.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/section07/property_syntax/TestPropertySyntax.scala
index 7cef9583f..f42bf24ac 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/section07/property_syntax/TestPropertySyntax.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/section07/property_syntax/TestPropertySyntax.scala
@@ -66,6 +66,13 @@ class TestPropertySyntax {
@Test def test_ignoredPropertiesWarning(): Unit = {
runner1.runOneTest("ignoredPropertiesWarning")
}
+ // DFDL-1842
+ @Test def test_overlappingProperties1(): Unit = {
+ runner1.runOneTest("overlappingProperties1")
+ }
+ @Test def test_overlappingProperties2(): Unit = {
+ runner1.runOneTest("overlappingProperties2")
+ }
@Test def test_badElementFormProperty(): Unit = {
runner1.runOneTest("badElementFormProperty")