This is an automated email from the ASF dual-hosted git repository.
slawrence 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 fb63083cf Add test for separatorSupressionPolicy='never'
fb63083cf is described below
commit fb63083cf41d184b06d863f7e97c94f53173937b
Author: Mike McGann <[email protected]>
AuthorDate: Fri Jan 27 14:51:56 2023 -0500
Add test for separatorSupressionPolicy='never'
The bug in the referenced ticket appears to have been fixed but shows that
there is no test coverage for when the separatorSupressionPolicy is set
to never. This update adds a test for this case.
DAFFODIL-2219
---
.../sequence_groups/SequenceGroupDelimiters.tdml | 33 ++++
.../org/apache/daffodil/usertests/test-5.tdml.xml | 168 ---------------------
.../sequence_groups/TestSequenceGroups.scala | 1 +
.../usertests/{RC-Test5.scala => RC-Test.scala} | 15 +-
4 files changed, 38 insertions(+), 179 deletions(-)
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
index c45ad1de0..574253888 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
@@ -614,4 +614,37 @@
</tdml:parserTestCase>
+ <tdml:defineSchema name="separatorSuppressionPolicy">
+
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"
outputNewLine="%CR;%LF;"/>
+
+ <xs:element name="policyNever">
+ <xs:complexType>
+ <xs:sequence dfdl:separator="%NL;" dfdl:sequenceKind="ordered"
dfdl:separatorSuppressionPolicy="never">
+ <xs:element name="A" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
+ <xs:element name="B" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
+ <xs:element name="C" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="separatorSuppressionPolicy_never"
model="separatorSuppressionPolicy">
+ <tdml:document>
+ <tdml:documentPart type="text"
+
replaceDFDLEntities="true"><![CDATA[Hello%CR;%LF;world%CR;%LF;]]></tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <tns:policyNever>
+ <tns:A>Hello</tns:A>
+ <tns:B>world</tns:B>
+ <tns:C></tns:C>
+ </tns:policyNever>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
</tdml:testSuite>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/test-5.tdml.xml
b/daffodil-test/src/test/resources/org/apache/daffodil/usertests/test-5.tdml.xml
deleted file mode 100644
index fbb03c28c..000000000
---
a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/test-5.tdml.xml
+++ /dev/null
@@ -1,168 +0,0 @@
-<?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="Bug Report test-5.dfdl.xsd"
- description="Bug in
everything-you-ever-wanted-to-know-about/separator/test-5.dfdl.xsd"
- xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xml="http://www.w3.org/XML/1998/namespace"
- xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:gpf="http://www.ibm.com/dfdl/GeneralPurposeFormat"
- xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
- xmlns:ex="http://example.com"
- defaultRoundTrip="none">
-
- <!--
- This example TDML file is for a self-contained bug report.
-
- It shows the definition of an inline schema and parse test and unparse
test that use that schema.
- -->
-
- <!--
- A DFDL schema is defined inside the tdml:defineSchema element. The contents
- are similar to a normal DFDL schema, allowing for imports, defining a
- global format via dfdl:defineFormat and dfdl:format, and defining schema
- xs:elements/groups/types/etc.
- -->
-
- <tdml:defineSchema name="test-5-Schema" elementFormDefault="unqualified">
-
- <dfdl:defineFormat name="default-dfdl-properties">
- <dfdl:format
- alignment="1"
- alignmentUnits="bytes"
- binaryFloatRep="ieee"
- binaryNumberRep="binary"
- bitOrder="mostSignificantBitFirst"
- byteOrder="bigEndian"
- calendarPatternKind="implicit"
- choiceLengthKind="implicit"
- documentFinalTerminatorCanBeMissing="yes"
- emptyValueDelimiterPolicy="none"
- encoding="ISO-8859-1"
- encodingErrorPolicy="replace"
- escapeSchemeRef=""
- fillByte="f"
- floating="no"
- ignoreCase="no"
- initiator=""
- initiatedContent="no"
- leadingSkip="0"
- lengthKind="delimited"
- lengthUnits="characters"
- nilKind="literalValue"
- nilValueDelimiterPolicy="none"
- occursCountKind="implicit"
- outputNewLine="%CR;%LF;"
- representation="text"
- separator=""
- separatorPosition="infix"
- separatorSuppressionPolicy="anyEmpty"
- sequenceKind="ordered"
- terminator=""
- textBidi="no"
- textNumberCheckPolicy="strict"
- textNumberPattern="#,##0.###;-#,##0.###"
- textNumberRep="standard"
- textNumberRounding="explicit"
- textNumberRoundingIncrement="0"
- textNumberRoundingMode="roundUnnecessary"
- textOutputMinLength="0"
- textPadKind="none"
- textStandardBase="10"
- textStandardDecimalSeparator="."
- textStandardExponentRep="E"
- textStandardInfinityRep="Inf"
- textStandardNaNRep="NaN"
- textStandardZeroRep="0"
- textStandardGroupingSeparator=","
- textTrimKind="none"
- trailingSkip="0"
- truncateSpecifiedLengthString="no"
- utf16Width="fixed"
- />
- </dfdl:defineFormat>
-
- <dfdl:format ref="ex:default-dfdl-properties" />
-
- <xs:element name="input">
- <xs:complexType>
- <xs:sequence dfdl:sequenceKind="ordered"
- dfdl:separator="%NL;" dfdl:separatorPosition="infix"
- dfdl:separatorSuppressionPolicy="never">
- <xs:element name="A" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
- <xs:element name="B" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
- <xs:element name="C" type="xs:string" minOccurs="0"
dfdl:occursCountKind="implicit" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- </tdml:defineSchema>
-
- <!--
- Define a parse test case, using the above schema and root element. Input
- data is defined along with the expected infoset.
- -->
-
- <tdml:parserTestCase name="parse-test-5" root="input" model="test-5-Schema"
- description="Test test-5.dfdl.xsd, in the parsing direction">
-
- <tdml:document>
- <tdml:documentPart type="text"
-
replaceDFDLEntities="true"><![CDATA[Hello%CR;%LF;world%CR;%LF;]]></tdml:documentPart>
- </tdml:document>
-
- <tdml:infoset>
- <tdml:dfdlInfoset>
- <ex:input>
- <A>Hello</A>
- <B>world</B>
- <C></C>
- </ex:input>
- </tdml:dfdlInfoset>
- </tdml:infoset>
-
- </tdml:parserTestCase>
-
- <!--
- Define an unparse test case, using the above schema and root element. An
- input infoset is defined along with the expected unparsed data.
- -->
-
- <tdml:unparserTestCase name="unparse-test-5" root="input"
model="test-5-Schema"
- description="Test test-5.dfdl.xsd, this time in the unparsing
direction.">
-
- <tdml:infoset>
- <tdml:dfdlInfoset>
- <ex:input>
- <A>Hello</A>
- <B>world</B>
- <C></C>
- </ex:input>
- </tdml:dfdlInfoset>
- </tdml:infoset>
-
- <tdml:document>
- <tdml:documentPart type="text"
-
replaceDFDLEntities="true"><![CDATA[Hello%CR;%LF;world]]></tdml:documentPart>
- </tdml:document>
-
- </tdml:unparserTestCase>
-
-</tdml:testSuite>
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/section14/sequence_groups/TestSequenceGroups.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/section14/sequence_groups/TestSequenceGroups.scala
index b9112fc79..8cb8758d8 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/section14/sequence_groups/TestSequenceGroups.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/section14/sequence_groups/TestSequenceGroups.scala
@@ -52,6 +52,7 @@ class TestSequenceGroups {
@Test def test_groupRefInheritProps(): Unit = {
runner_01.runOneTest("groupRefInheritProps") }
@Test def test_sequenceWithinSequence(): Unit = {
runner_01.runOneTest("sequenceWithinSequence") }
@Test def test_delimitedByNextInitFail(): Unit = {
runner_01.runOneTest("delimitedByNextInitFail") }
+ @Test def test_separatorSuppressionPolicy_never(): Unit = {
runner_01.runOneTest("separatorSuppressionPolicy_never") }
// DAFFODIL-669
// @Test def test_emptySequenceSDE() {
runner_02.runOneTest("emptySequenceSDE") }
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test5.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test.scala
similarity index 79%
rename from
daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test5.scala
rename to
daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test.scala
index 89523d3f6..4aad86a06 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test5.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/RC-Test.scala
@@ -17,32 +17,25 @@
package org.apache.daffodil.usertests
-import org.junit.Test
+// import org.junit.Test
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
-object RCTest5 {
+object RCTest {
val testDir = "/org/apache/daffodil/usertests/"
- val runner = Runner(testDir, "test-5.tdml.xml")
val runner6 = Runner(testDir, "test-6.tdml.xml")
@AfterClass def shutDown(): Unit = {
- runner.reset
runner6.reset
}
}
-class RCTest5 {
+class RCTest {
- import RCTest5._
-
- @Test def test5p(): Unit = { runner.runOneTest("parse-test-5") }
+ //import RCTest._
// DAFFODIL-2217
- // @Test def test5u() { runner.runOneTest("unparse-test-5") }
-
- // DAFFODIL-2219
// @Test def test6() { runner6.runOneTest("parse-test-6") }
}