git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] stevedlawrence commented on a change in pull request #64: Added tests to daffodil-test scala-debug for JIRA ticket DAFFODIL-1923.


stevedlawrence commented on a change in pull request #64: Added tests to daffodil-test scala-debug for JIRA ticket DAFFODIL-1923.
URL: https://github.com/apache/incubator-daffodil/pull/64#discussion_r183362627
 
 

 ##########
 File path: daffodil-tdml/src/test/resources/test/tdml/tdmlApostrophe.tdml
 ##########
 @@ -0,0 +1,68 @@
+<?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.
+-->
+
+<testSuite suiteName="tdmlApostrophe" xmlns="http://www.ibm.com/xmlns/dfdl/testData";
+  xmlns:tns="http://example.com"; 
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"; xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xmlns:fn="http://www.w3.org/2005/xpath-functions";
+  defaultRoundTrip="true">
+
+ 
+  <!--
+       Test Name: escBlkAposRemoved
+          Schema: eBlkAposRemoved
+            Root: record
+         Purpose: This test demonstrates that tdml runner correctly processes apostrophes (') in the html format (&apos;) within the infoset data (DAFFODIL-tbd).
+  -->
+  <defineSchema name="eBlkAposRemoved">
+    <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited" />
+
+    <dfdl:defineEscapeScheme name="eBlkAposRemovd">
+      <dfdl:escapeScheme escapeBlockStart="("
+        escapeBlockEnd=")" escapeKind="escapeBlock"
+        escapeEscapeCharacter="&quot;"  extraEscapedCharacters="" generateEscapeBlock="whenNeeded"/>
+    </dfdl:defineEscapeScheme>
+
+    <xs:element name="record">
+      <xs:complexType>
+        <xs:sequence dfdl:separator="," >
+          <xs:element name="item" type="xs:string" maxOccurs="unbounded"
+	    dfdl:escapeSchemeRef="tns:eBlkAposRemovd" />
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+  </defineSchema>
+ 
+  <parserTestCase name="escBlkAposRemoved" model="eBlkAposRemoved"
+    description="Section 7 defineEscapeScheme - DFDL-7-079R" root="record" roundTrip="false">
+    <document>1,(Column 'Number' Two),3,4,5</document>
+    <infoset>
+      <dfdlInfoset>
+    	<tns:record>
+    	  <tns:item>1</tns:item>
+    	  <tns:item>Column &apos;Number&apos; Two</tns:item>
+    	  <tns:item>3</tns:item>
+    	  <tns:item>4</tns:item>
+    	  <tns:item>5</tns:item>
+  	</tns:record>
+      </dfdlInfoset>
+    </infoset>
+  </parserTestCase>
+
+</testSuite>
 
 Review comment:
   This test is a little more complicated than it needs to be for what it is testing. Ideally, tests are as small as possible so that there are no unintended side effects. This test has escape schemes, delimited text, etc. Lots of things that don't really matter for &apos; to be tested. The test for this should probably be virtually the same as the test in tdmlQuoting, just with "apos" instead of "quot". It would also be reasonable to have the test in tdmlQuoting.tdml instead of creating a new file.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services