Repository: ant
Updated Branches:
  refs/heads/1.9.x d24dbe78c -> 270fb2cf3


try to get better error reporting from Jenkins


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/270fb2cf
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/270fb2cf
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/270fb2cf

Branch: refs/heads/1.9.x
Commit: 270fb2cf382a09ef8abe21879f8b0acb1eb36bf5
Parents: d24dbe7
Author: Stefan Bodewig <[email protected]>
Authored: Sun Jul 24 11:00:15 2016 +0200
Committer: Stefan Bodewig <[email protected]>
Committed: Sun Jul 24 11:00:15 2016 +0200

----------------------------------------------------------------------
 .../taskdefs/optional/native2ascii-test.xml     | 61 ++++++++++++--------
 1 file changed, 37 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/270fb2cf/src/tests/antunit/taskdefs/optional/native2ascii-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/optional/native2ascii-test.xml 
b/src/tests/antunit/taskdefs/optional/native2ascii-test.xml
index 1f7aa7f..a7e6b57 100644
--- a/src/tests/antunit/taskdefs/optional/native2ascii-test.xml
+++ b/src/tests/antunit/taskdefs/optional/native2ascii-test.xml
@@ -66,49 +66,62 @@ public class Adapter implements Native2AsciiAdapter {
     <au:assertLogContains text="adapter called"/>
   </target>
 
-  <target name="-setup-UTF8-To-ASCII">
+  <target name="-real-test-macros">
+    <macrodef name="assertTranslatedOutput">
+      <attribute name="file"/>
+      <attribute name="expected"/>
+      <attribute name="encoding"/>
+      <sequential>
+        <loadfile srcFile="${output}/@{file}" encoding="@{encoding}"
+                  property="@{file}.actual">
+          <filterchain>
+            <striplinebreaks/>
+          </filterchain>
+        </loadfile>
+        <au:assertEquals expected="@{expected}" actual="${@{file}.actual}"/>
+      </sequential>
+    </macrodef>
+    <presetdef name="native2ascii-def">
+      <native2ascii src="${input}" dest="${output}"
+                    includes="**/*.properties"/>
+    </presetdef>
+  </target>
+
+  <target name="-setup-UTF8-To-ASCII" depends="-real-test-macros">
     <mkdir dir="${input}"/>
     <mkdir dir="${output}"/>
-    <echo file="${input}/umlauts.properties" encoding="UTF-8">äöü=ÄÖÜ
-</echo>
-    <echo file="${output}/expected/umlauts.properties"
-          encoding="ASCII">\u00e4\u00f6\u00fc=\u00c4\u00d6\u00dc
-</echo>
+    <echo file="${input}/umlauts.properties" 
encoding="UTF-8">äöü=ÄÖÜ</echo>
+    <property name="umlauts.expected"
+              value="\u00e4\u00f6\u00fc=\u00c4\u00d6\u00dc"/>
   </target>
 
   <target name="testUTF8-To-ASCII" depends="-setup-UTF8-To-ASCII">
-    <native2ascii src="${input}" dest="${output}"
-                  includes="**/*.properties"/>
-    <au:assertFilesMatch actual="${output}/umlauts.properties"
-        expected="${output}/expected/umlauts.properties"/>
+    <native2ascii-def/>
+    <assertTranslatedOutput file="umlauts.properties" encoding="ASCII"
+                            expected="${umlauts.expected}"/>
   </target>
 
   <target name="testUTF8-To-ASCII-sun" depends="-setup-UTF8-To-ASCII"
           description="https://bz.apache.org/bugzilla/show_bug.cgi?id=59855";
           unless="jdk1.9+">
-    <native2ascii src="${input}" dest="${output}" implementation="sun"
-                  includes="**/*.properties"/>
-    <au:assertFilesMatch actual="${output}/umlauts.properties"
-        expected="${output}/expected/umlauts.properties"/>
+    <native2ascii-def implementation="sun"/>
+    <assertTranslatedOutput file="umlauts.properties" encoding="ASCII"
+                            expected="${umlauts.expected}"/>
   </target>
 
-  <target name="-setup-ASCII-To-UTF8">
+  <target name="-setup-ASCII-To-UTF8" depends="-real-test-macros">
     <mkdir dir="${input}"/>
     <mkdir dir="${output}"/>
-    <echo file="${input}/umlauts.properties" 
encoding="ASCII">\u00e4\u00f6\u00fc=\u00c4\u00d6\u00dc
-</echo>
-    <echo file="${output}/expected/umlauts.properties"
-          encoding="UTF-8">äöü=ÄÖÜ
-</echo>
+    <echo file="${input}/umlauts.properties" 
encoding="ASCII">\u00e4\u00f6\u00fc=\u00c4\u00d6\u00dc</echo>
+    <property name="umlauts.expected" value="äöü=ÄÖÜ"/>
   </target>
 
   <target name="testASCII-To-UTF8-sun" depends="-setup-ASCII-To-UTF8"
           description="https://bz.apache.org/bugzilla/show_bug.cgi?id=59855";
           unless="jdk1.9+">
-    <native2ascii src="${input}" dest="${output}" implementation="sun"
-                  reverse="true" includes="**/*.properties"/>
-    <au:assertFilesMatch actual="${output}/umlauts.properties"
-        expected="${output}/expected/umlauts.properties"/>
+    <native2ascii-def implementation="sun" reverse="true"/>
+    <assertTranslatedOutput file="umlauts.properties" encoding="UTF-8"
+                            expected="${umlauts.expected}"/>
   </target>
 
 </project>

Reply via email to