|
@@ -8,162 +8,172 @@ |
|
|
<delete dir="result" /> |
|
|
<delete dir="result" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
<macrodef name="assertequal"> |
|
|
|
|
|
<attribute name="junk" default="" /> |
|
|
|
|
|
<attribute name="name" default="Junk@{junk}.java" /> |
|
|
|
|
|
<attribute name="file1" default="result/@{name}" /> |
|
|
|
|
|
<attribute name="file2" default="expected/@{name}" /> |
|
|
|
|
|
<sequential> |
|
|
|
|
|
<fail message="@{file1} and @{file2} are different"> |
|
|
|
|
|
<condition> |
|
|
|
|
|
<not> |
|
|
|
|
|
<filesmatch file1="@{file1}" file2="@{file2}" /> |
|
|
|
|
|
</not> |
|
|
|
|
|
</condition> |
|
|
|
|
|
</fail> |
|
|
|
|
|
</sequential> |
|
|
|
|
|
</macrodef> |
|
|
|
|
|
|
|
|
<target name="test1" depends="init"> |
|
|
<target name="test1" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk1.java" |
|
|
includes="Junk1.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="add" |
|
|
|
|
|
eol="crlf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="add" eol="crlf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="1" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test2" depends="init"> |
|
|
<target name="test2" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk2.java" |
|
|
includes="Junk2.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="add" |
|
|
|
|
|
cr="add" |
|
|
|
|
|
eol="crlf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="add" cr="add" eol="crlf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="2" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test3" depends="init"> |
|
|
<target name="test3" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk3.java" |
|
|
includes="Junk3.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="remove" |
|
|
|
|
|
eol="lf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="3" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test4" depends="init"> |
|
|
<target name="test4" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk4.java" |
|
|
includes="Junk4.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="remove" |
|
|
|
|
|
eol="lf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="4" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test5" depends="init"> |
|
|
<target name="test5" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk5.java" |
|
|
includes="Junk5.java" |
|
|
tab="remove" |
|
|
|
|
|
eol="lf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
tab="remove" eol="lf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="5" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test6" depends="init"> |
|
|
<target name="test6" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk6.java" |
|
|
includes="Junk6.java" |
|
|
tab="add" |
|
|
|
|
|
cr="remove" |
|
|
|
|
|
eol="crlf" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
tab="add" cr="remove" eol="crlf" eof="asis" /> |
|
|
|
|
|
<assertequal junk="6" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test7" depends="init"> |
|
|
<target name="test7" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk7.java" |
|
|
includes="Junk7.java" |
|
|
tab="add" |
|
|
|
|
|
cr="add" |
|
|
|
|
|
eof="asis" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
tab="add" cr="add" eof="asis" /> |
|
|
|
|
|
<assertequal junk="7" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test8" depends="init"> |
|
|
<target name="test8" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk8.java" |
|
|
includes="Junk8.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="add" |
|
|
|
|
|
cr="add" |
|
|
|
|
|
eof="add" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="add" cr="add" eof="add" /> |
|
|
|
|
|
<assertequal junk="8" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="test9" depends="init"> |
|
|
<target name="test9" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Junk9.java" |
|
|
includes="Junk9.java" |
|
|
javafiles="true" |
|
|
|
|
|
tab="remove" |
|
|
|
|
|
cr="remove" |
|
|
|
|
|
eof="remove" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="true" tab="remove" cr="remove" eof="remove" /> |
|
|
|
|
|
<assertequal junk="9" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testMacLines" depends="init"> |
|
|
<target name="testMacLines" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="Mac2Unix" |
|
|
|
|
|
eol="lf" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="Mac2Unix" eol="lf" /> |
|
|
|
|
|
<assertequal name="Mac2Unix" /> |
|
|
|
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
<target name="testNoOverwrite" depends="test1"> |
|
|
|
|
|
<touch file="result/Junk1.java" millis="0" /> |
|
|
|
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
|
|
|
includes="Junk1.java" preservelastmodified="false" |
|
|
|
|
|
javafiles="true" tab="add" eol="crlf" eof="asis" /> |
|
|
|
|
|
<fail message="overwrote unchanged output file">Q |
|
|
|
|
|
<condition> |
|
|
|
|
|
<not> |
|
|
|
|
|
<isfileselected file="result/Junk1.java"> |
|
|
|
|
|
<date when="equal" millis="0" /> |
|
|
|
|
|
</isfileselected> |
|
|
|
|
|
</not> |
|
|
|
|
|
</condition> |
|
|
|
|
|
</fail> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testEncoding" depends="init"> |
|
|
<target name="testEncoding" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="input.crlf.utf16" |
|
|
includes="input.crlf.utf16" |
|
|
javafiles="false" |
|
|
|
|
|
cr="remove" |
|
|
|
|
|
encoding="UnicodeBig" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="false" cr="remove" encoding="UnicodeBig" /> |
|
|
|
|
|
<assertequal file1="result/input.crlf.utf16" |
|
|
|
|
|
file2="expected/input.lf.utf16" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testLongLines" depends="init"> |
|
|
<target name="testLongLines" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="longlines.crlf" |
|
|
includes="longlines.crlf" |
|
|
javafiles="false" |
|
|
|
|
|
cr="remove" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
javafiles="false" cr="remove" /> |
|
|
|
|
|
<assertequal file1="result/longlines.crlf" |
|
|
|
|
|
file2="expected/longlines.lf" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testCrCrLfSequence-unix" depends="init"> |
|
|
<target name="testCrCrLfSequence-unix" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="crcrlf" |
|
|
|
|
|
eol="lf" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="crcrlf" eol="lf" /> |
|
|
|
|
|
<assertequal file1="result/crcrlf" |
|
|
|
|
|
file2="expected/crcrlf.unix" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testCrCrLfSequence-dos" depends="init"> |
|
|
<target name="testCrCrLfSequence-dos" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="crcrlf" |
|
|
|
|
|
eol="crlf" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="crcrlf" eol="crlf" /> |
|
|
|
|
|
<assertequal file1="result/crcrlf" |
|
|
|
|
|
file2="expected/crcrlf.dos" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testCrCrLfSequence-mac" depends="init"> |
|
|
<target name="testCrCrLfSequence-mac" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="crcrlf" |
|
|
|
|
|
eol="cr" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="crcrlf" eol="cr" /> |
|
|
|
|
|
<assertequal file1="result/crcrlf" |
|
|
|
|
|
file2="expected/crcrlf.mac" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFixlastDos" depends="init"> |
|
|
<target name="testFixlastDos" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="fixlastfalse.lf" |
|
|
|
|
|
eol="crlf" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="fixlastfalse.lf" eol="crlf" /> |
|
|
|
|
|
<assertequal file1="result/fixlastfalse.lf" |
|
|
|
|
|
file2="expected/fixlast.dos" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFixlastFalseMac" depends="init"> |
|
|
<target name="testFixlastFalseMac" depends="init"> |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
<fixcrlf srcdir="input" destdir="result" |
|
|
includes="fixlastfalse.lf" |
|
|
|
|
|
eol="cr" |
|
|
|
|
|
fixlast="false" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
includes="fixlastfalse.lf" eol="cr" fixlast="false" /> |
|
|
|
|
|
<assertequal file1="result/fixlastfalse.lf" |
|
|
|
|
|
file2="expected/fixlastfalse.mac" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<!-- Bugzilla Report 20840 --> |
|
|
<!-- Bugzilla Report 20840 --> |
|
|
<target name="createParentDirs" depends="init"> |
|
|
<target name="createParentDirs" depends="init"> |
|
|
<fixcrlf srcdir="." destdir="result" includes="input/Junk1.java"/> |
|
|
|
|
|
|
|
|
<fixcrlf srcdir="." destdir="result" includes="input/Junk1.java" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFixFile" depends="init"> |
|
|
<target name="testFixFile" depends="init"> |
|
|
<fixcrlf file="input/longlines.crlf" destdir="result" /> |
|
|
<fixcrlf file="input/longlines.crlf" destdir="result" /> |
|
|
|
|
|
<fail message="didn't create output file"> |
|
|
|
|
|
<condition> |
|
|
|
|
|
<not> |
|
|
|
|
|
<available file="result/longlines.crlf" /> |
|
|
|
|
|
</not> |
|
|
|
|
|
</condition> |
|
|
|
|
|
</fail> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFixFileExclusive" depends="init"> |
|
|
<target name="testFixFileExclusive" depends="init"> |
|
@@ -194,20 +204,6 @@ |
|
|
<fail unless="fs" /> |
|
|
<fail unless="fs" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<macrodef name="testjunk"> |
|
|
|
|
|
<attribute name="n" /> |
|
|
|
|
|
<sequential> |
|
|
|
|
|
<fail> |
|
|
|
|
|
<condition> |
|
|
|
|
|
<not> |
|
|
|
|
|
<filesmatch file1="result/Junk@{n}.java" |
|
|
|
|
|
file2="expected/Junk@{n}.java" /> |
|
|
|
|
|
</not> |
|
|
|
|
|
</condition> |
|
|
|
|
|
</fail> |
|
|
|
|
|
</sequential> |
|
|
|
|
|
</macrodef> |
|
|
|
|
|
|
|
|
|
|
|
<target name="testFilter1" depends="init"> |
|
|
<target name="testFilter1" depends="init"> |
|
|
<copy file="input/Junk1.java" todir="result" overwrite="true"> |
|
|
<copy file="input/Junk1.java" todir="result" overwrite="true"> |
|
|
<filterchain> |
|
|
<filterchain> |
|
@@ -215,7 +211,7 @@ |
|
|
eol="crlf" eof="asis" /> |
|
|
eol="crlf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="1" /> |
|
|
|
|
|
|
|
|
<assertequal junk="1" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter2" depends="init"> |
|
|
<target name="testFilter2" depends="init"> |
|
@@ -224,7 +220,7 @@ |
|
|
<fixcrlf javafiles="true" tab="add" cr="add" eol="crlf" eof="asis" /> |
|
|
<fixcrlf javafiles="true" tab="add" cr="add" eol="crlf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="2" /> |
|
|
|
|
|
|
|
|
<assertequal junk="2" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter3" depends="init"> |
|
|
<target name="testFilter3" depends="init"> |
|
@@ -233,7 +229,7 @@ |
|
|
<fixcrlf javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
<fixcrlf javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="3" /> |
|
|
|
|
|
|
|
|
<assertequal junk="3" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter4" depends="init"> |
|
|
<target name="testFilter4" depends="init"> |
|
@@ -242,7 +238,7 @@ |
|
|
<fixcrlf javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
<fixcrlf javafiles="true" tab="remove" eol="lf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="4" /> |
|
|
|
|
|
|
|
|
<assertequal junk="4" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter5" depends="init"> |
|
|
<target name="testFilter5" depends="init"> |
|
@@ -251,7 +247,7 @@ |
|
|
<fixcrlf tab="remove" eol="lf" eof="asis" /> |
|
|
<fixcrlf tab="remove" eol="lf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="5" /> |
|
|
|
|
|
|
|
|
<assertequal junk="5" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter6" depends="init"> |
|
|
<target name="testFilter6" depends="init"> |
|
@@ -260,7 +256,7 @@ |
|
|
<fixcrlf tab="add" cr="remove" eol="crlf" eof="asis" /> |
|
|
<fixcrlf tab="add" cr="remove" eol="crlf" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="6" /> |
|
|
|
|
|
|
|
|
<assertequal junk="6" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter7" depends="init"> |
|
|
<target name="testFilter7" depends="init"> |
|
@@ -269,7 +265,7 @@ |
|
|
<fixcrlf tab="add" cr="add" eof="asis" /> |
|
|
<fixcrlf tab="add" cr="add" eof="asis" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="7" /> |
|
|
|
|
|
|
|
|
<assertequal junk="7" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter8" depends="init"> |
|
|
<target name="testFilter8" depends="init"> |
|
@@ -278,7 +274,7 @@ |
|
|
<fixcrlf javafiles="true" tab="add" cr="add" eof="add" /> |
|
|
<fixcrlf javafiles="true" tab="add" cr="add" eof="add" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="8" /> |
|
|
|
|
|
|
|
|
<assertequal junk="8" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="testFilter9" depends="init"> |
|
|
<target name="testFilter9" depends="init"> |
|
@@ -287,7 +283,13 @@ |
|
|
<fixcrlf javafiles="true" tab="remove" cr="remove" eof="remove" /> |
|
|
<fixcrlf javafiles="true" tab="remove" cr="remove" eof="remove" /> |
|
|
</filterchain> |
|
|
</filterchain> |
|
|
</copy> |
|
|
</copy> |
|
|
<testjunk n="9" /> |
|
|
|
|
|
|
|
|
<assertequal junk="9" /> |
|
|
|
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
<target name="testCannotDoubleEof" depends="test8"> |
|
|
|
|
|
<fixcrlf file="result/Junk8.java" |
|
|
|
|
|
javafiles="true" tab="add" cr="add" eof="add" /> |
|
|
|
|
|
<assertequal junk="8" /> |
|
|
</target> |
|
|
</target> |
|
|
|
|
|
|
|
|
</project> |
|
|
</project> |