jadams-tresys commented on code in PR #987:
URL: https://github.com/apache/daffodil/pull/987#discussion_r1907763250
##########
daffodil-test/src/test/resources/org/apache/daffodil/section07/discriminators/discriminator.tdml:
##########
@@ -765,13 +814,66 @@
<tdml:parserTestCase name="discrimExpression_04"
root="e3" model="discrimExpression"
- description="Property Name: test - DFDL-7-076R">
+ description="Verify that a discriminator will prevent backtracking
+ regardless of whether the sequence content parses succesfully">
<tdml:document><![CDATA[abc]]></tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>Failed to populate ex:ints</tdml:error>
+ <tdml:error>Unable to parse xs:int from text: a</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="discrimExpression_05"
+ root="e4" model="discrimExpression"
+ description="Verify that a failed discriminator will be handled correctly
+ when the body of the sequence parses successfully">
+ <tdml:document><![CDATA[123]]></tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset>
- <e3>
+ <e4>
+ <string>123</string>
+ </e4>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="discrimExpression_06"
+ root="e4" model="discrimExpression"
+ description="Verify correct behavior when the body of a sequence fails and
+ the discriminator fails">
+ <tdml:document><![CDATA[abc]]></tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <e4>
<string>abc</string>
- </e3>
+ </e4>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="discrimExpression_07"
+ root="e5" model="discrimExpression"
+ description="Sequence body fails, but discriminator succeeds and references
+ elements in partial body infoset">
+ <tdml:document><![CDATA[1ab]]></tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>Failed to populate ex:ints</tdml:error>
+ <tdml:error>Unable to parse xs:int from text: a</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="discrimExpression_08"
Review Comment:
Is this not what discrimExpression_07 covers?
It has a discriminator expression that references the first element of a
sequence (which does parse correctly). The 2nd element of the sequence then
fails, which causes a parse error instead of back tracking.
--
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]