stevel      2004/04/19 06:42:57

  Modified:    src/etc/testcases/types/assertions AssertionTest.java
               src/etc/testcases/types assertions.xml
               src/testcases/org/apache/tools/ant/types AssertionsTest.java
  Added:       src/etc/testcases/types/assertions AssertionMain.java
  Log:
  This is a test that demonstrates that assert checks dont get through 
properly. Fix in progress.
  
  Revision  Changes    Path
  1.4       +21 -6     ant/src/etc/testcases/types/assertions/AssertionTest.java
  
  Index: AssertionTest.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/etc/testcases/types/assertions/AssertionTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AssertionTest.java        9 Feb 2004 21:05:16 -0000       1.3
  +++ AssertionTest.java        19 Apr 2004 13:42:57 -0000      1.4
  @@ -15,15 +15,30 @@
    * 
    */
    
  + import junit.framework.TestCase;
   
   /**
  - * this is an assertion tester
  + * this is an assertion tester for junit 
    */
  -public class AssertionTest {
  +public class AssertionTest extends TestCase {
       
  -    public static void main(String args[]) {
  -             assert true == false : "there exist no facts that are both true 
and false";
  -             System.out.println("Assertions are disabled");
  -    }
  +     public AssertionTest(String name) {
  +             super(name);
  +     }
  +     
  +     public void testAssertRaised() {
  +             try {
  +                     assert true == false;
  +                     fail("expected an assertion");
  +             } catch(AssertionError asserto) {
  +                     //if we got here, all was well
  +             }
  +     }
  +     
  +     
  +     public void testAssertNotRaised() {
  +             assert(2+2==4);
  +     }
  +     
       
   }
  
  
  
  1.1                  ant/src/etc/testcases/types/assertions/AssertionMain.java
  
  Index: AssertionMain.java
  ===================================================================
  /* 
   * Copyright  2003-2004 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.
   * 
   */
   
  
  /**
   * this is an assertion tester
   * It has a main() entry
   */
  public class AssertionMain {
      
      public static void main(String args[]) {
                assert true == false : "there exist no facts that are both true 
and false";
                System.out.println("Assertions are disabled");
      }
      
  }
  
  
  
  1.2       +19 -1     ant/src/etc/testcases/types/assertions.xml
  
  Index: assertions.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/types/assertions.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- assertions.xml    23 Sep 2003 06:31:46 -0000      1.1
  +++ assertions.xml    19 Apr 2004 13:42:57 -0000      1.2
  @@ -4,7 +4,8 @@
   
     <property name="build.dir" location="assertions/build"/>
     <property name="src.dir" location="assertions"/>
  -  <property name="classname" value="AssertionTest"/>
  +  <property name="classname" value="AssertionMain"/>
  +  <property name="test.classname" value="AssertionTest"/>
     
     <path id="assert.classpath">
       <pathelement location="${build.dir}"/>
  @@ -149,5 +150,22 @@
         </assertions>      
       </java>
     </target>    
  +  
  +    
  +  <target name="test-junit" depends="setup">
  +    <junit fork="true" 
  +      haltonerror="true" haltonfailure="true"
  +      >
  +      <classpath>
  +        <path refid="assert.classpath"/>
  +      </classpath>
  +      <formatter type="plain"     usefile="false"/>
  +      <assertions enablesystemassertions="true">
  +        <enable package="..." />
  +      </assertions> 
  +      <test name="${test.classname}"/>
  +    </junit>
  +  </target>
  +    
     
   </project>
  
  
  
  1.5       +3 -0      
ant/src/testcases/org/apache/tools/ant/types/AssertionsTest.java
  
  Index: AssertionsTest.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/types/AssertionsTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AssertionsTest.java       9 Feb 2004 21:05:45 -0000       1.4
  +++ AssertionsTest.java       19 Apr 2004 13:42:57 -0000      1.5
  @@ -90,6 +90,9 @@
       }
   
   
  +    public void testJunit() {
  +        executeTarget("test-junit");
  +    }
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to