You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ja...@apache.org on 2020/07/27 17:48:18 UTC
[incubator-daffodil] branch master updated: Added test case for
DAFFODIL-2375
This is an automated email from the ASF dual-hosted git repository.
jadams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new 38f6f3d Added test case for DAFFODIL-2375
38f6f3d is described below
commit 38f6f3d3bf34d7945e44164400d875f6d8c5d7a6
Author: Josh Adams <ja...@tresys.com>
AuthorDate: Fri Jul 24 12:55:56 2020 -0400
Added test case for DAFFODIL-2375
---
.../daffodil/section07/variables/variables.tdml | 62 ++++++++++++++++++++++
.../section07/variables/TestVariables.scala | 3 ++
2 files changed, 65 insertions(+)
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables.tdml
index 515ee3f..35eb691 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables.tdml
@@ -1692,4 +1692,66 @@
</tdml:errors>
</tdml:parserTestCase>
+ <tdml:defineSchema name="choice_branch_variables">
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" />
+
+ <dfdl:defineVariable name="var1" type="xs:string" defaultValue="false" />
+ <dfdl:defineVariable name="var2" type="xs:string" defaultValue="false" />
+ <xs:element name="root">
+ <xs:complexType>
+ <xs:sequence dfdl:separator=",">
+ <xs:element name="record" minOccurs="0" maxOccurs="2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:unsignedShort" dfdl:lengthKind="explicit" dfdl:length="1" />
+ <xs:choice>
+ <xs:choice dfdl:choiceDispatchKey="{ xs:string(ex:id) }">
+ <xs:sequence dfdl:choiceBranchKey="1">
+ <xs:annotation>
+ <xs:appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:setVariable ref="var1" value="true" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:sequence>
+ <xs:sequence dfdl:choiceBranchKey="2">
+ <xs:annotation>
+ <xs:appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:setVariable ref="var2" value="true" />
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:sequence>
+ </xs:choice>
+ <xs:sequence />
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="var1_val" type="xs:string" dfdl:inputValueCalc="{ $ex:var1 }" />
+ <xs:element name="var2_val" type="xs:string" dfdl:inputValueCalc="{ $ex:var2 }" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="choiceBranchVariables" root="root"
+ model="choice_branch_variables" description="Section 7 - setVariable - relative path expression - DFDL-7-126R">
+ <tdml:document>1,2</tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <root>
+ <record>
+ <id>1</id>
+ </record>
+ <record>
+ <id>2</id>
+ </record>
+ <var1_val>true</var1_val>
+ <var2_val>true</var2_val>
+ </root>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
</tdml:testSuite>
diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section07/variables/TestVariables.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section07/variables/TestVariables.scala
index b6dd5b8..79d62b8 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/section07/variables/TestVariables.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/section07/variables/TestVariables.scala
@@ -93,6 +93,9 @@ class TestVariables {
@Test def test_unsignedIntVarCast(): Unit = { runner.runOneTest("unsignedIntVarCast") }
+ // DFDL-2375
+ //@Test def test_choiceBranchVariables(): Unit = { runner.runOneTest("choiceBranchVariables") }
+
@Test def test_doubleSetErr_d(): Unit = { runner_01.runOneTest("doubleSetErr_d") }
@Test def test_setVar1_d(): Unit = { runner_01.runOneTest("setVar1_d") }
// DFDL-1443 & DFDL-1448