Repository: ant Updated Branches: refs/heads/master 039a348aa -> 5ebe69330
use git attributes to control line-ends Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/5ebe6933 Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/5ebe6933 Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/5ebe6933 Branch: refs/heads/master Commit: 5ebe693305ecdf67089f8860b8f12f5c07cdb0ec Parents: 039a348 Author: Stefan Bodewig <[email protected]> Authored: Sat Apr 25 12:50:21 2015 +0200 Committer: Stefan Bodewig <[email protected]> Committed: Sat Apr 25 12:50:21 2015 +0200 ---------------------------------------------------------------------- .gitattributes | 43 ++++ .gitignore | 58 ++--- src/etc/poms/ant-junit4/pom.xml | 142 +++++------ src/etc/testcases/.gitattributes | 1 + .../filters/expected/escapeunicode.test | 18 +- .../testcases/filters/input/escapeunicode.test | 18 +- src/etc/testcases/taskdefs/exec/blabla.xml | 38 +-- src/script/.gitattributes | 2 + src/tests/antunit/taskdefs/.gitattributes | 1 + src/tests/antunit/taskdefs/get-test.xml | 250 +++++++++---------- .../antunit/taskdefs/propertyfile-test.xml | 86 +++---- .../org/apache/tools/ant/types/selectors/README | 192 +++++++------- src/tests/junit/org/example/tasks/antlib.xml | 52 ++-- src/tests/junit/org/example/tasks/antlib2.xml | 52 ++-- 14 files changed, 500 insertions(+), 453 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/.gitattributes ---------------------------------------------------------------------- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..31d1184 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,43 @@ +*.bat eol=crlf +*.bz2 binary +*.cmd eol=crlf +*.css text +*.dtd text +*.g text +*.gif binary +*.gz binary +*.html text diff=html +*.ico binary +*.inc text +*.jar binary +*.jpg binary +*.jsp text +*.md text +*.md5 text +*.md5sum text +*.mf text +*.pl text diff=perl +*.properties text +*.py text diff=python +*.result text +*.sample text +*.sh eol=lf +*.tar binary +*.test text +*.txt text +*.wxs text +*.xml text +*.xsd text +*.xsl text +*.zip binary +.gitattributes text +.gitignore text +CONTRIBUTORS text +INSTALL text +KEY text +LICENSE text +NOTICE text +README text +ReleaseInstructions text +STATUS text +WHATSNEW text http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 5394891..ac9499a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,29 @@ -*.el -*.ipr -*.iws -*.pif -.ant.properties -.classpath -.project -.settings -bin -apache-ant-1.* -bootstrap -build -dist -distribution -java-repository -patch.tar.gz -patch.txt -target -velocity.log* -lib/optional/*.jar -src/tests/antunit/core/output -.idea -*.iml -/src/GPATH -/src/GRTAGS -/src/GSYMS -/src/GTAGS -/log.xml -lib/optional/license.txt +*.el +*.ipr +*.iws +*.pif +.ant.properties +.classpath +.project +.settings +bin +apache-ant-1.* +bootstrap +build +dist +distribution +java-repository +patch.tar.gz +patch.txt +target +velocity.log* +lib/optional/*.jar +src/tests/antunit/core/output +.idea +*.iml +/src/GPATH +/src/GRTAGS +/src/GSYMS +/src/GTAGS +/log.xml +lib/optional/license.txt http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/etc/poms/ant-junit4/pom.xml ---------------------------------------------------------------------- diff --git a/src/etc/poms/ant-junit4/pom.xml b/src/etc/poms/ant-junit4/pom.xml index b380de4..ac6ed6f 100644 --- a/src/etc/poms/ant-junit4/pom.xml +++ b/src/etc/poms/ant-junit4/pom.xml @@ -1,71 +1,71 @@ -<?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. ---> -<!-- - This POM has been created manually by the Ant Development Team. - Please contact us if you are not satisfied with the data contained in this POM. - URL : http://ant.apache.org ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.apache.ant</groupId> - <artifactId>ant-parent</artifactId> - <relativePath>../pom.xml</relativePath> - <version>1.9.5-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <url>http://ant.apache.org/</url> - <groupId>org.apache.ant</groupId> - <artifactId>ant-junit4</artifactId> - <version>1.9.5-SNAPSHOT</version> - <name>Apache Ant + JUnit 4</name> - <description>contains JUnit 4.x support</description> - <dependencies> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>1.9.5-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>compile</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <includes> - <include>org/apache/tools/ant/taskdefs/optional/junit/JUnit4TestMethodAdapter*</include> - <include>org/apache/tools/ant/taskdefs/optional/junit/CustomJUnit4TestAdapterCache*</include> - </includes> - </configuration> - </plugin> - </plugins> - <sourceDirectory>../../../../src/main</sourceDirectory> - <testSourceDirectory>../../../../src/testcases</testSourceDirectory> - <outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory> - <testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory> - <directory>../../../../target/${project.artifactId}</directory> - </build> -</project> +<?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. +--> +<!-- + This POM has been created manually by the Ant Development Team. + Please contact us if you are not satisfied with the data contained in this POM. + URL : http://ant.apache.org +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.ant</groupId> + <artifactId>ant-parent</artifactId> + <relativePath>../pom.xml</relativePath> + <version>1.9.5-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <url>http://ant.apache.org/</url> + <groupId>org.apache.ant</groupId> + <artifactId>ant-junit4</artifactId> + <version>1.9.5-SNAPSHOT</version> + <name>Apache Ant + JUnit 4</name> + <description>contains JUnit 4.x support</description> + <dependencies> + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>1.9.5-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>compile</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <includes> + <include>org/apache/tools/ant/taskdefs/optional/junit/JUnit4TestMethodAdapter*</include> + <include>org/apache/tools/ant/taskdefs/optional/junit/CustomJUnit4TestAdapterCache*</include> + </includes> + </configuration> + </plugin> + </plugins> + <sourceDirectory>../../../../src/main</sourceDirectory> + <testSourceDirectory>../../../../src/testcases</testSourceDirectory> + <outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory> + <testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory> + <directory>../../../../target/${project.artifactId}</directory> + </build> +</project> http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/etc/testcases/.gitattributes ---------------------------------------------------------------------- diff --git a/src/etc/testcases/.gitattributes b/src/etc/testcases/.gitattributes new file mode 100644 index 0000000..3dfdde1 --- /dev/null +++ b/src/etc/testcases/.gitattributes @@ -0,0 +1 @@ +input.stdin text http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/etc/testcases/filters/expected/escapeunicode.test ---------------------------------------------------------------------- diff --git a/src/etc/testcases/filters/expected/escapeunicode.test b/src/etc/testcases/filters/expected/escapeunicode.test index ffede99..4ad3280 100644 --- a/src/etc/testcases/filters/expected/escapeunicode.test +++ b/src/etc/testcases/filters/expected/escapeunicode.test @@ -1,9 +1,9 @@ -#hebrew shalom olam (hello world) -text.hebrew=\u05e9\u05dc\u05d5\u05dd \u05e2\u05d5\u05dc\u05dd -#goethe gingko biloba -text.german.1=Sp\u00fcrst du nicht an meinen Liedern, -text.german.2=Da\u00df ich eins und doppelt bin ? -# Francois Villon Ballade des Pendus -text.french=Fr\u00e8res humains qui apr\u00e8s nous vivez -# Usual IT example -text.basic.latin=Hello World +#hebrew shalom olam (hello world) +text.hebrew=\u05e9\u05dc\u05d5\u05dd \u05e2\u05d5\u05dc\u05dd +#goethe gingko biloba +text.german.1=Sp\u00fcrst du nicht an meinen Liedern, +text.german.2=Da\u00df ich eins und doppelt bin ? +# Francois Villon Ballade des Pendus +text.french=Fr\u00e8res humains qui apr\u00e8s nous vivez +# Usual IT example +text.basic.latin=Hello World http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/etc/testcases/filters/input/escapeunicode.test ---------------------------------------------------------------------- diff --git a/src/etc/testcases/filters/input/escapeunicode.test b/src/etc/testcases/filters/input/escapeunicode.test index 1f01178..bf86150 100644 --- a/src/etc/testcases/filters/input/escapeunicode.test +++ b/src/etc/testcases/filters/input/escapeunicode.test @@ -1,9 +1,9 @@ -#hebrew shalom olam (hello world) -text.hebrew=ש××× ×¢××× -#goethe gingko biloba -text.german.1=Spürst du nicht an meinen Liedern, -text.german.2=Daà ich eins und doppelt bin ? -# Francois Villon Ballade des Pendus -text.french=Frères humains qui après nous vivez -# Usual IT example -text.basic.latin=Hello World +#hebrew shalom olam (hello world) +text.hebrew=ש××× ×¢××× +#goethe gingko biloba +text.german.1=Spürst du nicht an meinen Liedern, +text.german.2=Daà ich eins und doppelt bin ? +# Francois Villon Ballade des Pendus +text.french=Frères humains qui après nous vivez +# Usual IT example +text.basic.latin=Hello World http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/etc/testcases/taskdefs/exec/blabla.xml ---------------------------------------------------------------------- diff --git a/src/etc/testcases/taskdefs/exec/blabla.xml b/src/etc/testcases/taskdefs/exec/blabla.xml index 1c3ba07..3b13195 100644 --- a/src/etc/testcases/taskdefs/exec/blabla.xml +++ b/src/etc/testcases/taskdefs/exec/blabla.xml @@ -1,19 +1,19 @@ -<project name="blabla" default="doit"> - <target name="blabla"> - <exec executable="sh"> - <arg value="blabla.sh" /> - </exec> - </target> - <target name="doit"> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - <antcall target="blabla"/> - </target> -</project> +<project name="blabla" default="doit"> + <target name="blabla"> + <exec executable="sh"> + <arg value="blabla.sh" /> + </exec> + </target> + <target name="doit"> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + <antcall target="blabla"/> + </target> +</project> http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/script/.gitattributes ---------------------------------------------------------------------- diff --git a/src/script/.gitattributes b/src/script/.gitattributes new file mode 100644 index 0000000..25bc157 --- /dev/null +++ b/src/script/.gitattributes @@ -0,0 +1,2 @@ +ant eol=lf +anrRun eol=lf http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/antunit/taskdefs/.gitattributes ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/.gitattributes b/src/tests/antunit/taskdefs/.gitattributes new file mode 100644 index 0000000..dc5b3e8 --- /dev/null +++ b/src/tests/antunit/taskdefs/.gitattributes @@ -0,0 +1 @@ +utf-16.* binary http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/antunit/taskdefs/get-test.xml ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/get-test.xml b/src/tests/antunit/taskdefs/get-test.xml index e1f021b..0bca337 100644 --- a/src/tests/antunit/taskdefs/get-test.xml +++ b/src/tests/antunit/taskdefs/get-test.xml @@ -1,125 +1,125 @@ -<?xml version="1.0"?> -<!-- - 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. ---> - -<project name="get-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> - <import file="../antunit-base.xml" /> - - <property name="location" value="http://ant.apache.org/webtest/gettest" /> - - <target name="setUp"> - <mkdir dir="${output}" /> - </target> - - <target name="testSeeOtherRedirect"> - <get src="${location}/other.txt" dest="${output}/other.tmp"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/other.tmp" /> - <contains text="seeother redirect succeeded" /> - </restrict> - </resourcecount> - </au:assertTrue> - <au:assertLogContains text="other.txt moved to http" /> - </target> - - <target name="testPermanentRedirect"> - <get src="${location}/permanent.txt" dest="${output}/permanent.tmp"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/permanent.tmp" /> - <contains text="permanent redirect succeeded" /> - </restrict> - </resourcecount> - </au:assertTrue> - <au:assertLogContains text="permanent.txt permanently moved to http" /> - </target> - - <target name="testTemporaryRedirect"> - <get src="${location}/temp.txt" dest="${output}/temp.txt"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/temp.txt" /> - <contains text="temporary redirect succeeded" /> - </restrict> - </resourcecount> - </au:assertTrue> - <au:assertLogContains text="temp.txt moved to http" /> - </target> - - <target name="testStatusCode307Redirect"> - <get src="${location}/307.txt" dest="${output}/307.txt"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/307.txt" /> - <contains text="307 status code redirect succeeded" /> - </restrict> - </resourcecount> - </au:assertTrue> - <au:assertLogContains text="307.txt moved to http" /> - </target> - - <target name="test5LevelsOfRedirect"> - <get src="${location}/redir5.txt" dest="${output}/redir5.tmp"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/redir5.tmp" /> - <contains text="5 levels of redirect succeeded" /> - </restrict> - </resourcecount> - </au:assertTrue> - - <au:assertLogContains text="redir5.txt moved to http" /> - - <au:assertLogContains text="redir5-4.txt moved to http" /> - </target> - - - <target name="testInfiniteRedirect"> - <au:expectfailure expectedmessage="More than 25 times redirected, giving up"> - <get src="${location}/infinite.txt" dest="${output}/infinite.tmp"/> - </au:expectfailure> - </target> - - - <target name="testNestedResources"> - <get dest="${output}/downloads"> - <url url="http://ant.apache.org/index.html"/> - <url url="http://ant.apache.org/faq.html"/> - </get> - <au:assertFileExists file="${output}/downloads/index.html"/> - <au:assertFileExists file="${output}/downloads/faq.html"/> - </target> - - <target name="XtestRelativeRedirect"> - <get src="${location}/local.cgi" dest="${output}/other.tmp"/> - <au:assertTrue> - <resourcecount count="1"> - <restrict> - <file file="${output}/other.tmp" /> - <contains text="local redirect succeeded"/> - </restrict> - </resourcecount> - </au:assertTrue> - <au:assertLogContains text="local.cgi moved to http" /> - </target> -</project> +<?xml version="1.0"?> +<!-- + 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. +--> + +<project name="get-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> + <import file="../antunit-base.xml" /> + + <property name="location" value="http://ant.apache.org/webtest/gettest" /> + + <target name="setUp"> + <mkdir dir="${output}" /> + </target> + + <target name="testSeeOtherRedirect"> + <get src="${location}/other.txt" dest="${output}/other.tmp"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/other.tmp" /> + <contains text="seeother redirect succeeded" /> + </restrict> + </resourcecount> + </au:assertTrue> + <au:assertLogContains text="other.txt moved to http" /> + </target> + + <target name="testPermanentRedirect"> + <get src="${location}/permanent.txt" dest="${output}/permanent.tmp"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/permanent.tmp" /> + <contains text="permanent redirect succeeded" /> + </restrict> + </resourcecount> + </au:assertTrue> + <au:assertLogContains text="permanent.txt permanently moved to http" /> + </target> + + <target name="testTemporaryRedirect"> + <get src="${location}/temp.txt" dest="${output}/temp.txt"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/temp.txt" /> + <contains text="temporary redirect succeeded" /> + </restrict> + </resourcecount> + </au:assertTrue> + <au:assertLogContains text="temp.txt moved to http" /> + </target> + + <target name="testStatusCode307Redirect"> + <get src="${location}/307.txt" dest="${output}/307.txt"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/307.txt" /> + <contains text="307 status code redirect succeeded" /> + </restrict> + </resourcecount> + </au:assertTrue> + <au:assertLogContains text="307.txt moved to http" /> + </target> + + <target name="test5LevelsOfRedirect"> + <get src="${location}/redir5.txt" dest="${output}/redir5.tmp"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/redir5.tmp" /> + <contains text="5 levels of redirect succeeded" /> + </restrict> + </resourcecount> + </au:assertTrue> + + <au:assertLogContains text="redir5.txt moved to http" /> + + <au:assertLogContains text="redir5-4.txt moved to http" /> + </target> + + + <target name="testInfiniteRedirect"> + <au:expectfailure expectedmessage="More than 25 times redirected, giving up"> + <get src="${location}/infinite.txt" dest="${output}/infinite.tmp"/> + </au:expectfailure> + </target> + + + <target name="testNestedResources"> + <get dest="${output}/downloads"> + <url url="http://ant.apache.org/index.html"/> + <url url="http://ant.apache.org/faq.html"/> + </get> + <au:assertFileExists file="${output}/downloads/index.html"/> + <au:assertFileExists file="${output}/downloads/faq.html"/> + </target> + + <target name="XtestRelativeRedirect"> + <get src="${location}/local.cgi" dest="${output}/other.tmp"/> + <au:assertTrue> + <resourcecount count="1"> + <restrict> + <file file="${output}/other.tmp" /> + <contains text="local redirect succeeded"/> + </restrict> + </resourcecount> + </au:assertTrue> + <au:assertLogContains text="local.cgi moved to http" /> + </target> +</project> http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/antunit/taskdefs/propertyfile-test.xml ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/propertyfile-test.xml b/src/tests/antunit/taskdefs/propertyfile-test.xml index 106991a..b02cfa4 100644 --- a/src/tests/antunit/taskdefs/propertyfile-test.xml +++ b/src/tests/antunit/taskdefs/propertyfile-test.xml @@ -1,44 +1,44 @@ -<?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. - --> -<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> - - <import file="../antunit-base.xml" /> - - <target name="-fileResourceSetup"> - <mkdir dir="${output}"/> - </target> - - <target name="testInternationalText" depends="-fileResourceSetup" - description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50515"> - <property name="line1" value="è¬ å© é£ å æ¹ ç¼ å ¬ å¸" /> - <property name="line2" value="TEL: (123)123-1234" /> - <propertyfile file="${output}/test.properties"> - <entry key="line1" value="${line1}" /> - <entry key="line2" value="${line2}" /> - </propertyfile> - <loadproperties prefix="rereading" srcfile="${output}/test.properties"/> - <au:assertTrue message="${line2}"> - <equals arg1="${line2}" arg2="${rereading.line2}" /> - </au:assertTrue> - <au:assertTrue message="${line1}"> - <equals arg1="${line1}" arg2="${rereading.line1}" /> - </au:assertTrue> - - </target> - +<?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. + --> +<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> + + <import file="../antunit-base.xml" /> + + <target name="-fileResourceSetup"> + <mkdir dir="${output}"/> + </target> + + <target name="testInternationalText" depends="-fileResourceSetup" + description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50515"> + <property name="line1" value="è¬ å© é£ å æ¹ ç¼ å ¬ å¸" /> + <property name="line2" value="TEL: (123)123-1234" /> + <propertyfile file="${output}/test.properties"> + <entry key="line1" value="${line1}" /> + <entry key="line2" value="${line2}" /> + </propertyfile> + <loadproperties prefix="rereading" srcfile="${output}/test.properties"/> + <au:assertTrue message="${line2}"> + <equals arg1="${line2}" arg2="${rereading.line2}" /> + </au:assertTrue> + <au:assertTrue message="${line1}"> + <equals arg1="${line1}" arg2="${rereading.line1}" /> + </au:assertTrue> + + </target> + </project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/junit/org/apache/tools/ant/types/selectors/README ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/README b/src/tests/junit/org/apache/tools/ant/types/selectors/README index de407b4..eb48f6b 100644 --- a/src/tests/junit/org/apache/tools/ant/types/selectors/README +++ b/src/tests/junit/org/apache/tools/ant/types/selectors/README @@ -1,96 +1,96 @@ -A DESCRIPTION OF THE SELECTOR TEST FRAMEWORK - -When writing tests for selectors, I found that I wanted to have some -standard way of working with a set of files and testing whether one or -another of them was selected. To that end, I created a base class called -BaseSelectorTest that does most of the heavy lifting. Of course, you can -test your selectors any way you want, but if you want to reuse this code, -read on. - -What BaseSelectorTest does is use an ant build file -"src/etc/testcases/types/selector.xml" to copy a tree of files out of -"src/etc/testcases/taskdefs/expected" into a "selectortest" directories. -Then it takes a list of 12 of the files and directories in this tree, and -applies whatever selector you pass in to each one. It passes back to your -test a 12 character long string indicating which of the 12 files and -directories was selected, using 'T' for selected and 'F' for not selected. -In the Test class for your selector, you override the getInstance() method -to create your own type of selector, and set the elements of your selector -a variety of ways to ensure that the string of T's and F's returned when -the selector is applied to those 12 files is correct. - -So, for example, DepthSelectorTest.java extends BaseSelectorTest and has -the following code: - - - public BaseSelector getInstance() { - return new DepthSelector(); - } - - - public void testSelectionBehaviour() { - DepthSelector s; - String results; - - - try { - makeBed(); - - - s = (DepthSelector)getInstance(); - s.setMin(20); - s.setMax(25); - results = selectionString(s); - assertEquals("FFFFFFFFFFFF", results); - - - s = (DepthSelector)getInstance(); - s.setMin(0); - results = selectionString(s); - assertEquals("TTTTTTTTTTTT", results); - - - s = (DepthSelector)getInstance(); - s.setMin(1); - results = selectionString(s); - assertEquals("FFFFFTTTTTTT", results); - - -The first test says that none of the 12 files or directories will match if -the depth range for the selector is between 20 and 25 (that would be one -deep directory tree!). The second says that all files and directories -match if the minimum depth is set to 0 and the maximum isn't specified. The -third test says that if the minumum depth is 1, the first 5 entries in the -list of 12 will not be selected and the rest will. - - -You can find the 12 files and directories that are tested for selection in -the BaseSelectorTest class. I used a fixed list so that if someone added -new files to the src/etc/testcases/types directory it wouldn't break my -tests: - - - protected String[] filenames = {".","asf-logo.gif.md5","asf- - logo.gif.bz2", - "asf-logo.gif.gz","copy.filterset.filtered","zip/asf- - logo.gif.zip", - "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz", - "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2", - "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"}; - - -If you wish to use this set of files and directories to test your selector, -you can reuse the BaseSelectorTest with no change to it. - -You may find you need to alter the build file so that you get some -variation in the files that your selector can work with. Most of the core -selectors have required that kind of modification. If you do that, make -sure that it doesn't alter the output strings on the other selector test, -or if it does that you update their expected return results. - -You may also want to alter the set of files you look at in a particular -selector test. Since the filelist in BaseSelectorTest is protected, you -should be able to override it as you need to. Or you can alter the fileset -in BaseSelectorTest itself, provided you update the test strings in all the -other unit tests. - +A DESCRIPTION OF THE SELECTOR TEST FRAMEWORK + +When writing tests for selectors, I found that I wanted to have some +standard way of working with a set of files and testing whether one or +another of them was selected. To that end, I created a base class called +BaseSelectorTest that does most of the heavy lifting. Of course, you can +test your selectors any way you want, but if you want to reuse this code, +read on. + +What BaseSelectorTest does is use an ant build file +"src/etc/testcases/types/selector.xml" to copy a tree of files out of +"src/etc/testcases/taskdefs/expected" into a "selectortest" directories. +Then it takes a list of 12 of the files and directories in this tree, and +applies whatever selector you pass in to each one. It passes back to your +test a 12 character long string indicating which of the 12 files and +directories was selected, using 'T' for selected and 'F' for not selected. +In the Test class for your selector, you override the getInstance() method +to create your own type of selector, and set the elements of your selector +a variety of ways to ensure that the string of T's and F's returned when +the selector is applied to those 12 files is correct. + +So, for example, DepthSelectorTest.java extends BaseSelectorTest and has +the following code: + + + public BaseSelector getInstance() { + return new DepthSelector(); + } + + + public void testSelectionBehaviour() { + DepthSelector s; + String results; + + + try { + makeBed(); + + + s = (DepthSelector)getInstance(); + s.setMin(20); + s.setMax(25); + results = selectionString(s); + assertEquals("FFFFFFFFFFFF", results); + + + s = (DepthSelector)getInstance(); + s.setMin(0); + results = selectionString(s); + assertEquals("TTTTTTTTTTTT", results); + + + s = (DepthSelector)getInstance(); + s.setMin(1); + results = selectionString(s); + assertEquals("FFFFFTTTTTTT", results); + + +The first test says that none of the 12 files or directories will match if +the depth range for the selector is between 20 and 25 (that would be one +deep directory tree!). The second says that all files and directories +match if the minimum depth is set to 0 and the maximum isn't specified. The +third test says that if the minumum depth is 1, the first 5 entries in the +list of 12 will not be selected and the rest will. + + +You can find the 12 files and directories that are tested for selection in +the BaseSelectorTest class. I used a fixed list so that if someone added +new files to the src/etc/testcases/types directory it wouldn't break my +tests: + + + protected String[] filenames = {".","asf-logo.gif.md5","asf- + logo.gif.bz2", + "asf-logo.gif.gz","copy.filterset.filtered","zip/asf- + logo.gif.zip", + "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz", + "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2", + "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"}; + + +If you wish to use this set of files and directories to test your selector, +you can reuse the BaseSelectorTest with no change to it. + +You may find you need to alter the build file so that you get some +variation in the files that your selector can work with. Most of the core +selectors have required that kind of modification. If you do that, make +sure that it doesn't alter the output strings on the other selector test, +or if it does that you update their expected return results. + +You may also want to alter the set of files you look at in a particular +selector test. Since the filelist in BaseSelectorTest is protected, you +should be able to override it as you need to. Or you can alter the fileset +in BaseSelectorTest itself, provided you update the test strings in all the +other unit tests. + http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/junit/org/example/tasks/antlib.xml ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/example/tasks/antlib.xml b/src/tests/junit/org/example/tasks/antlib.xml index 2d876579..b920da7 100644 --- a/src/tests/junit/org/example/tasks/antlib.xml +++ b/src/tests/junit/org/example/tasks/antlib.xml @@ -1,26 +1,26 @@ -<?xml version="1.0"?> -<!-- - 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. ---> -<antlib> -<macrodef name="simple"> - <element name="some-tasks" optional="yes" implicit="yes"/> - <sequential> - <some-tasks/> - </sequential> -</macrodef> -</antlib> - +<?xml version="1.0"?> +<!-- + 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. +--> +<antlib> +<macrodef name="simple"> + <element name="some-tasks" optional="yes" implicit="yes"/> + <sequential> + <some-tasks/> + </sequential> +</macrodef> +</antlib> + http://git-wip-us.apache.org/repos/asf/ant/blob/5ebe6933/src/tests/junit/org/example/tasks/antlib2.xml ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/example/tasks/antlib2.xml b/src/tests/junit/org/example/tasks/antlib2.xml index 2d876579..b920da7 100644 --- a/src/tests/junit/org/example/tasks/antlib2.xml +++ b/src/tests/junit/org/example/tasks/antlib2.xml @@ -1,26 +1,26 @@ -<?xml version="1.0"?> -<!-- - 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. ---> -<antlib> -<macrodef name="simple"> - <element name="some-tasks" optional="yes" implicit="yes"/> - <sequential> - <some-tasks/> - </sequential> -</macrodef> -</antlib> - +<?xml version="1.0"?> +<!-- + 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. +--> +<antlib> +<macrodef name="simple"> + <element name="some-tasks" optional="yes" implicit="yes"/> + <sequential> + <some-tasks/> + </sequential> +</macrodef> +</antlib> +
