Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 7 years ago
parent
commit
0e17a81580
2 changed files with 14 additions and 6 deletions
  1. +10
    -4
      src/tests/antunit/taskdefs/optional/native2ascii-test.xml
  2. +4
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java

+ 10
- 4
src/tests/antunit/taskdefs/optional/native2ascii-test.xml View File

@@ -18,6 +18,11 @@
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../../antunit-base.xml" />

<target name="tearDown" depends="antunit-base.tearDown"
if="n2a.tmp">
<delete dir="${n2a.tmp}" failonerror="false" deleteonexit="true"/>
</target>

<target name="-create-native2ascii-adapter">
<mkdir dir="${input}/org/example"/>
<echo file="${input}/org/example/Adapter.java"><![CDATA[
@@ -88,9 +93,10 @@ public class Adapter implements Native2AsciiAdapter {
</target>

<target name="-setup-UTF8-To-ASCII" depends="-real-test-macros">
<mkdir dir="${input}"/>
<property name="n2a.tmp" location="${input}/../ant-native2ascii-test"/>
<mkdir dir="${n2a.tmp}"/>
<mkdir dir="${output}"/>
<echo file="${input}/umlauts.properties" encoding="UTF-8">äöü=ÄÖÜ</echo>
<echo file="${n2a.tmp}/umlauts.properties" encoding="UTF-8">äöü=ÄÖÜ</echo>
<property name="umlauts.expected"
value="\u00e4\u00f6\u00fc=\u00c4\u00d6\u00dc"/>
</target>
@@ -98,14 +104,14 @@ public class Adapter implements Native2AsciiAdapter {
<target name="testUTF8-To-ASCII-sun" depends="-setup-UTF8-To-ASCII"
description="https://bz.apache.org/bugzilla/show_bug.cgi?id=59855"
unless="jdk9+">
<native2ascii-def implementation="sun"/>
<native2ascii-def implementation="sun" src="${n2a.tmp}"/>
<assertTranslatedOutput file="umlauts.properties" encoding="ASCII"
expected="${umlauts.expected}"/>
</target>

<target name="testUTF8-To-ASCII-builtin" depends="-setup-UTF8-To-ASCII"
description="https://bz.apache.org/bugzilla/show_bug.cgi?id=59855">
<native2ascii-def implementation="builtin"/>
<native2ascii-def implementation="builtin" src="${n2a.tmp}"/>
<assertTranslatedOutput file="umlauts.properties" encoding="ASCII"
expected="${umlauts.expected}"/>
</target>


+ 4
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java View File

@@ -223,8 +223,10 @@ public class CopyTest {
File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/fileNR.txt");
assertTrue(file1.exists());
try {
String file1Content = FileUtils.readFully(new FileReader(file1));
assertEquals("This is file 42", file1Content);
try (FileReader f = new FileReader(file1)) {
String file1Content = FileUtils.readFully(f);
assertEquals("This is file 42", file1Content);
}
} catch (IOException e) {
// no-op: not a real business error
}


Loading…
Cancel
Save