mike-mcgann commented on code in PR #898:
URL: https://github.com/apache/daffodil/pull/898#discussion_r1054840096


##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -349,5 +340,73 @@
     </tdml:errors>
   </tdml:parserTestCase>
 
+  <tdml:parserTestCase name="test_sep_ssp_never_4_daffodil" root="file2" 
model="s4"
+                       implementations="daffodil">
+    <tdml:document>madonna,,,,,,,,,</tdml:document>
+    <tdml:warnings>
+      <tdml:warning>emptyElementParsePolicy is deprecated</tdml:warning>
+      <tdml:warning>Use dfdl:emptyElementParsePolicy</tdml:warning>
+    </tdml:warnings>
+    <tdml:errors>
+      <tdml:error>Parse Error</tdml:error>
+      <tdml:error>Empty element not allowed</tdml:error>
+      <tdml:error>required</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
+
+  <!--
+  This schema identical to s3, except for the emptyElementParsePolicy is 
treatAsAbsent
+  -->
+  <tdml:defineSchema name="s5" elementFormDefault="unqualified">
+
+    <xs:include 
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format
+            ref="ex:GeneralFormatPortable"
+            representation="text"
+            lengthKind="delimited"
+            separatorPosition="infix"
+            emptyElementParsePolicy="treatAsAbsent"/>
+
+    <!--
+    treatAsAbsent should have no effect here, because everything is optional.
+    -->
+    <xs:element name="file1">
+      <xs:complexType>
+        <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"
+                     dfdl:separatorSuppressionPolicy="never">
+          <xs:element name="given-name" type="xs:string" minOccurs="0" 
maxOccurs="3"/>
+          <xs:element name="surname" type="xs:string" minOccurs="0"/>
+          <xs:element name="phone" type="xs:string" minOccurs="0" 
maxOccurs="6"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+
+    <!-- Same, but has minOccurs=maxOccurs for the arrays.
+     That makes all array elements "required"
+
+     treatAsAbsent causes this to fail. Required empty non-defaultable is an 
error in that case.
+     -->
+    <xs:element name="file2">
+      <xs:complexType>
+        <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"
+                     dfdl:separatorSuppressionPolicy="never">
+          <xs:element name="given-name" type="xs:string" minOccurs="3" 
maxOccurs="3"/>
+          <xs:element name="surname" type="xs:string"/>
+          <xs:element name="phone" type="xs:string" minOccurs="6" 
maxOccurs="6"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+
+  </tdml:defineSchema>
+
+  <tdml:parserTestCase name="test_sep_ssp_never_5" root="file2" model="s5"
+                       implementations="daffodil">
+    <tdml:document>madonna,,,,,,,,,</tdml:document>
+    <tdml:errors>
+      <tdml:error>Parse Error</tdml:error>
+      <tdml:error>Empty element not allowed</tdml:error>
+      <tdml:error>required</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
 
 </tdml:testSuite>

Review Comment:
   Added



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to