You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/07/01 11:59:51 UTC

svn commit: r208741 - in /ant/sandbox/antlibs/antunit/trunk/src/etc/testcases: ./ antunit/ antunit/expected/ antunit/input/

Author: bodewig
Date: Fri Jul  1 02:59:49 2005
New Revision: 208741

URL: http://svn.apache.org/viewcvs?rev=208741&view=rev
Log:
Port parts of the copy testsuite

Added:
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml   (with props)
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered   (with props)
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/utf-8   (with props)
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset   (with props)
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/iso8859-1   (with props)
Modified:
    ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit.xml

Modified: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit.xml
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit.xml?rev=208741&r1=208740&r2=208741&view=diff
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit.xml (original)
+++ ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit.xml Fri Jul  1 02:59:49 2005
@@ -25,4 +25,11 @@
       <au:plainlistener/>
     </au:antunit>
   </target>
+
+  <target name="antunit-copy">
+    <au:antunit>
+      <fileset dir="antunit" includes="copy.xml"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
 </project>

Added: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml?rev=208741&view=auto
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml (added)
+++ ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml Fri Jul  1 02:59:49 2005
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright  2005 The Apache Software Foundation
+ 
+  Licensed 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="copy-test" basedir="." default="test1"
+  xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="test1">
+    <au:assertFileDoesntExist file="copytest1.tmp"/>
+    <copy file="copy.xml" tofile="copytest1.tmp"/>
+    <au:assertFileExists file="copytest1.tmp"/>
+  </target>
+ 
+  <target name="test2">
+    <au:assertFileDoesntExist file="copytest1dir/copy.xml"/>
+    <copy file="copy.xml" todir="copytest1dir" overwrite="true"/>
+    <au:assertFileExists file="copytest1dir/copy.xml"/>
+  </target>
+
+  <target name="filtertest">
+    <!-- check fix for bugzilla 23154 -->
+    <delete quiet="yes" file="copy.filter.out"/>
+    <delete quiet="yes" file="copy.filter.inp"/>
+    <concat destfile="copy.filter.inp">
+PRODUCT_VERSION=6.2.1.4
+PRODUCT_BUILD=6.5 (BLD_65036)
+PRODUCT_VERSION=6.2.1.4
+PRODUCT_BUILD=6.5 (BLD_65036)
+    </concat>
+    <copy file="copy.filter.inp" tofile="copy.filter.out">
+      <filterset begintoken="6" endtoken="4">
+        <filter token=".2.1." value="2.6.4" />
+      </filterset>
+    </copy>
+    <concat><path path="copy.filter.out"/></concat>
+  </target>
+
+  <target name="infinitetest">
+    <delete quiet="yes" file="copy.filter.out"/>
+    <delete quiet="yes" file="copy.filter.inp"/>
+    <concat destfile="copy.filter.inp">
+a=b=
+    </concat>
+    <copy file="copy.filter.inp" tofile="copy.filter.out">
+      <filterset begintoken="=" endtoken="=">
+        <filter token="b" value="=b="/>
+      </filterset>
+    </copy>
+    <concat><path path="copy.filter.out"/></concat>
+  </target>
+
+  <target name="test3">
+    <!-- create an empty file -->
+    <touch file="copytest3.tmp"/>
+    <!--wait -->
+    <sleep seconds="4"/>
+    <!-- copy a different file to two places --> 
+    <copy file="copy.xml" tofile="copytest3a.tmp" overwrite="true"/>
+    <copy file="copy.xml" tofile="copytest3b.tmp" overwrite="true"/>
+    <!--wait -->
+    <sleep seconds="4"/>
+    <!-- copy an old file onto a newer file (should not work) -->
+    <copy file="copytest3.tmp" tofile="copytest3b.tmp" />
+    <au:assertDestIsUptodate dest="copytest3b.tmp" src="copytest3.tmp"/>
+    <!-- copy an older file onto a new one, should succeed -->
+    <copy file="copytest3.tmp" tofile="copytest3c.tmp"
+      overwrite="true"
+      preservelastmodified="true" />
+    <au:assertDestIsUptodate src="copytest3c.tmp" dest="copytest3b.tmp"/>
+    <!-- copy a newer file onto an older one (should work) -->
+    <copy file="copytest3a.tmp" tofile="copytest3.tmp" 
+      preservelastmodified="true" />
+    <au:assertDestIsUptodate src="copytest3c.tmp" dest="copytest3b.tmp"/>
+    <!-- expected state :
+      3a.tmp==3.tmp==copy.xml
+      timeof(3a.tmp)==timeof(3.tmp)==now()-4
+      sizeof(3c)==0
+      timeof(3c.tmp)<timeof(3a.tmp);
+      3b.tmp==copy.xml
+    -->
+  </target>
+  
+  <target name="test_single_file_fileset">
+    <au:assertFileDoesntExist file="copytest_single_file_fileset.tmp"/>
+    <copy tofile="copytest_single_file_fileset.tmp">
+      <fileset dir="." includes="copy.xml"/>
+    </copy>
+    <au:assertFileExists file="copytest_single_file_fileset.tmp"/>
+  </target>
+  
+  <target name="testFilterSet">
+    <au:assertFileDoesntExist file="copy.filterset.tmp"/>
+    <au:assertFilesDiffer actual="input/copy.filterset"
+      expected="expected/copy.filterset.filtered"/>
+    <copy file="input/copy.filterset" tofile="copy.filterset.tmp">
+      <filterset>
+        <filter token="TITLE" value="Apache Ant Project"/>
+      </filterset>
+    </copy>
+    <au:assertFileExists file="copy.filterset.tmp"/>
+    <au:assertFilesMatch actual="copy.filterset.tmp"
+      expected="expected/copy.filterset.filtered"/>
+  </target>
+
+  <target name="testFilterChain">
+    <au:assertFileDoesntExist file="copy.filterchain.tmp"/>
+    <au:assertFilesDiffer actual="input/copy.filterset"
+      expected="expected/copy.filterset.filtered"/>
+    <copy file="input/copy.filterset" tofile="copy.filterchain.tmp">
+      <filterchain>
+        <replacetokens>
+          <token key="TITLE" value="Apache Ant Project"/>
+        </replacetokens>
+      </filterchain>
+    </copy>
+    <au:assertFileExists file="copy.filterchain.tmp"/>
+    <au:assertFilesMatch actual="copy.filterchain.tmp"
+      expected="expected/copy.filterset.filtered"/>
+  </target>
+
+  <target name="testTranscoding">
+    <au:assertFileDoesntExist file="copytest1.tmp"/>
+    <au:assertFilesDiffer actual="input/iso8859-1" expected="expected/utf-8"/>
+    <copy file="input/iso8859-1" tofile="copytest1.tmp"
+          encoding="ISO8859_1" outputencoding="UTF8"/>
+    <au:assertFileExists file="copytest1.tmp"/>
+    <au:assertFilesMatch actual="copytest1.tmp" expected="expected/utf-8"/>
+  </target>
+
+  <target name="XtestMissingFileIgnore">
+    <copy file="not-there" tofile="copytest1.tmp"
+          failonerror="false"/>
+  </target>
+
+  <target name="XtestMissingFileBail">
+    <copy file="not-there" tofile="copytest1.tmp"
+          failonerror="true"/>
+  </target>
+
+  <target name="XtestMissingDirIgnore">
+    <copy todir="copytest1dir" failonerror="false">
+      <fileset dir="not-there"/>
+    </copy>
+  </target>
+
+  <target name="XtestMissingDirBail">
+    <copy todir="copytest1dir" failonerror="true">
+      <fileset dir="not-there"/>
+    </copy>
+  </target>
+
+  <target name="tearDown"> 
+    <delete file="copytest1.tmp"/>
+    <delete file="copytest3.tmp"/>
+    <delete file="copytest3a.tmp"/>
+    <delete file="copytest3b.tmp"/>
+    <delete file="copytest3c.tmp"/>
+    <delete file="copytest_single_file_fileset.tmp"/>
+    <delete file="copy.filterset.tmp"/>
+    <delete file="copy.filterchain.tmp"/>
+    <delete dir="copytest1dir"/>
+    <delete quiet="yes" file="copy.filter.out"/>
+    <delete quiet="yes" file="copy.filter.inp"/>
+  </target>
+
+</project>

Propchange: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered?rev=208741&view=auto
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered (added)
+++ ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered Fri Jul  1 02:59:49 2005
@@ -0,0 +1 @@
+This is the Apache Ant Project.

Propchange: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/copy.filterset.filtered
------------------------------------------------------------------------------
    svn:eolstyle = native

Added: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/utf-8
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/utf-8?rev=208741&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/expected/utf-8
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset?rev=208741&view=auto
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset (added)
+++ ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset Fri Jul  1 02:59:49 2005
@@ -0,0 +1 @@
+This is the @TITLE@.

Propchange: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/copy.filterset
------------------------------------------------------------------------------
    svn:eolstyle = native

Added: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/iso8859-1
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/iso8859-1?rev=208741&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/sandbox/antlibs/antunit/trunk/src/etc/testcases/antunit/input/iso8859-1
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r208741 - in /ant/sandbox/antlibs/antunit/trunk/src/etc/testcases: ./ antunit/ antunit/expected/ antunit/input/

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 01 Jul 2005, <bo...@apache.org> wrote:

> Port parts of the copy testsuite

The parts I've not ported yet show where AntUnit currently lacks
support for things our JUnit tests can do.  Tests that assert log
statements and tests that assert build failures can't be done right
now.

I plan to address the later by a custom <expectfailure> task container
(much like a specialized <trycatch> task) and the former by a
<capture> task (much like <record> but puts the log into a project
reference) and matching assertions.

Help - as always - is welcome

     Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org