You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/12/26 18:55:26 UTC
[GitHub] [incubator-daffodil] mbeckerle opened a new pull request #307: Fix
choice bug DAFFODIL-2259
mbeckerle opened a new pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307
Added test for this.
Also adding tests to mil-std-2045 schema that exercise the previously
unused element that would have shown this bug up before.
DAFFODIL-2259
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull
request #307: Fix choice bug DAFFODIL-2259
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307#discussion_r361514354
##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice-unparse2.tdml
##########
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<tdml:testSuite suiteName="choice" description="Tests for choice construct"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
+ xmlns:ex="http://example.com">
+
+ <tdml:defineSchema name="c"
+ elementFormDefault="unqualified">
+
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"/>
+
+ <xs:element name="e">
+ <xs:complexType>
+ <xs:choice>
Review comment:
Add comment here to document what this test is specifically covering, which is DAFFODIL-2259, a bug where a choice element that is an array was fooling construction of the unparser eventUnparserMap.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull
request #307: Fix choice bug DAFFODIL-2259
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307#discussion_r361514166
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
##########
@@ -31,9 +31,12 @@ import org.apache.daffodil.api.WarnID
import org.apache.daffodil.processors.ChoiceDispatchKeyEv
import org.apache.daffodil.dsom.ExpressionCompilers
import org.apache.daffodil.dpath.NodeInfo
+import org.apache.daffodil.grammar.Gram
trait ChoiceTermRuntime1Mixin { self: ChoiceTermBase =>
+ protected def alternatives: Seq[Gram]
Review comment:
Add scala doc. The alternatives are the members of the choice group with special treatment given to some kinds of members. An invariant is that if a direct child member is an array element, the child will have been encapsulated as a sequence, so that arrays always live within sequences.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-daffodil] bsloane1650 commented on a change in pull
request #307: Fix choice bug DAFFODIL-2259
Posted by GitBox <gi...@apache.org>.
bsloane1650 commented on a change in pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307#discussion_r361523396
##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice-unparse2.tdml
##########
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<tdml:testSuite suiteName="choice" description="Tests for choice construct"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
+ xmlns:ex="http://example.com">
+
+ <tdml:defineSchema name="c"
+ elementFormDefault="unqualified">
+
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"/>
+
+ <xs:element name="e">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="a" type="xs:int" dfdl:terminator=";"
+ maxOccurs="2" minOccurs="1"/>
+ <xs:element name="b" type="xs:string">
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+
+ </tdml:defineSchema>
+
+<tdml:unparserTestCase name="choice_with_array_branch1" root="e" model="c">
+
+ <tdml:document>1;</tdml:document>
+
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <ex:e>
+ <a>1</a>
Review comment:
For the sake of completeness, we should have another test where <a/> occurs twice.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-daffodil] mbeckerle merged pull request #307: Fix choice
bug DAFFODIL-2259
Posted by GitBox <gi...@apache.org>.
mbeckerle merged pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull
request #307: Fix choice bug DAFFODIL-2259
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #307: Fix choice bug DAFFODIL-2259
URL: https://github.com/apache/incubator-daffodil/pull/307#discussion_r361514535
##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/choice-unparse2.tdml
##########
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<tdml:testSuite suiteName="choice" description="Tests for choice construct"
Review comment:
Improve or remove suiteName and description
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services