This is an automated email from the ASF dual-hosted git repository.
jadams 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 2b48c1f Added test case for DAFFODIL-2562
2b48c1f is described below
commit 2b48c1f3ce1f39b1cce4fbf9caa6ea56316f8126
Author: Josh Adams <[email protected]>
AuthorDate: Thu Sep 23 12:36:49 2021 -0400
Added test case for DAFFODIL-2562
Added a relatively simple test case demonstrating the bug.
DAFFODIL-2562
---
.../daffodil/section15/choice_groups/choice.tdml | 43 ++++++++++++++++++++++
.../section15/choice_groups/TestChoice.scala | 3 ++
2 files changed, 46 insertions(+)
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice.tdml
index b9a8f5d..90b917f 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice.tdml
@@ -1779,6 +1779,32 @@ it sure is/
</xs:complexType>
</xs:element>
+ <xs:group name="groupOfChoice">
+ <xs:sequence>
+ <xs:element name="key" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
+ <xs:choice dfdl:choiceDispatchKey="{ ./ex:key }">
+ <xs:sequence dfdl:choiceBranchKey="a">
+ <xs:element name="elt_a" type="xs:string"
dfdl:lengthKind="explicit" dfdl:length="3" />
+ </xs:sequence>
+ <xs:sequence dfdl:choiceBranchKey="b">
+ <xs:element name="elt_b" type="xs:string"
dfdl:lengthKind="explicit" dfdl:length="3" />
+ <xs:element name="elt_c" type="xs:string"
dfdl:lengthKind="explicit" dfdl:length="3"
+ minOccurs="0" maxOccurs="1" dfdl:occursCountKind="expression"
dfdl:occursCount="{ if (fn:exists(../ex:elt_b)) then 1 else 0 }" />
+ </xs:sequence>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="dd9">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="prev" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
+ <xs:group ref="groupOfChoice" />
+ <xs:element name="post" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
</tdml:defineSchema>
<tdml:parserTestCase name="direct_dispatch_01" root="dd1"
@@ -2003,4 +2029,21 @@ it sure is/
</tdml:infoset>
</tdml:parserTestCase>
+ <tdml:parserTestCase name="dispatch_group_choice" root="dd9"
+ model="direct_dispatch_1" roundTrip="true"
+ description="simple case of direct dispatch - DFDL-15-001R. Uses group
containing a choice with direct dispatch">
+ <tdml:document><![CDATA[0bbbbccc1]]></tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset xmlns:ex="http://example.com">
+ <ex:dd9>
+ <ex:prev>0</ex:prev>
+ <ex:key>b</ex:key>
+ <ex:elt_b>bbb</ex:elt_b>
+ <ex:elt_c>ccc</ex:elt_c>
+ <ex:post>1</ex:post>
+ </ex:dd9>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
</tdml:testSuite>
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/section15/choice_groups/TestChoice.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/section15/choice_groups/TestChoice.scala
index dd09192..35bbd5b 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/section15/choice_groups/TestChoice.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/section15/choice_groups/TestChoice.scala
@@ -119,6 +119,9 @@ class TestChoice {
@Test def test_direct_dispatch_16(): Unit = {
runnerCH.runOneTest("direct_dispatch_16") }
@Test def test_direct_dispatch_17(): Unit = {
runnerCH.runOneTest("direct_dispatch_17") }
+ // DAFFODIL-2562
+ // @Test def test_dispatch_group_choice(): Unit = {
runnerCH.runOneTest("dispatch_group_choice") }
+
@Test def test_explicit_01(): Unit = { runnerCE.runOneTest("explicit_01") }
@Test def test_explicit_02(): Unit = { runnerCE.runOneTest("explicit_02") }
@Test def test_explicit_03(): Unit = { runnerCE.runOneTest("explicit_03") }