ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs LoadFileTest.java
Date Thu, 07 Mar 2002 19:42:31 GMT
umagesh     02/03/07 11:42:30

  Modified:    src/etc/testcases/taskdefs loadfile.xml
               src/main/org/apache/tools/ant/filters StripJavaComments.java
               src/testcases/org/apache/tools/ant/taskdefs
                        LoadFileTest.java
  Log:
  Fix StripJavaComments such that it strips out java comments properly.  Testcase added.
  
  Revision  Changes    Path
  1.5       +37 -0     jakarta-ant/src/etc/testcases/taskdefs/loadfile.xml
  
  Index: loadfile.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/loadfile.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- loadfile.xml	6 Mar 2002 03:25:50 -0000	1.4
  +++ loadfile.xml	7 Mar 2002 19:42:30 -0000	1.5
  @@ -87,6 +87,42 @@
         </loadfile>
     </target>
   
  +  <target name="testStripJavaComments"
  +    depends="init">
  +      <echo file="loadfile1.tmp">
  +/*
  +Comment "1"
  +*/
  +public class test1 {
  +    //Some comment
  +    int x = 1/2;
  +    private static final String GREETING="*/Hello/*";
  +    private static final String GREETING1="/*Hello*/";
  +
  +    public static void main( String args[] ) {
  +    }
  +}</echo>
  +      <echo file="nocomments.tmp">
  +
  +public class test1 {
  +    
  +    int x = 1/2;
  +    private static final String GREETING="*/Hello/*";
  +    private static final String GREETING1="/*Hello*/";
  +
  +    public static void main( String args[] ) {
  +    }
  +}</echo>
  +      <loadfile srcFile="loadfile1.tmp" 
  +        property="testStripJavaComments">
  +        <filterchain>
  +          <stripjavacomments/>
  +        </filterchain>
  +      </loadfile>
  +      <loadfile srcFile="nocomments.tmp" 
  +        property="expected"/>
  +  </target>
  +
     <target name="testOneLine"
       depends="init">
       <echo
  @@ -105,6 +141,7 @@
   
     <target name="cleanup">
       <delete file="loadfile1.tmp"/>
  +    <delete file="nocomments.tmp"/>
     </target>
   
     </project>
  
  
  
  1.3       +0 -2      jakarta-ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java
  
  Index: StripJavaComments.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/filters/StripJavaComments.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StripJavaComments.java	7 Mar 2002 18:30:17 -0000	1.2
  +++ StripJavaComments.java	7 Mar 2002 19:42:30 -0000	1.3
  @@ -62,8 +62,6 @@
    * (if you have more complex Java parsing needs, use a real lexer).
    * Since this class heavily relies on the single char read function,
    * you are reccomended to make it work on top of a buffered reader.
  - *
  - * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
    */
   public final class StripJavaComments
       extends BaseFilterReader
  
  
  
  1.7       +11 -0     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/LoadFileTest.java
  
  Index: LoadFileTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/LoadFileTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LoadFileTest.java	6 Mar 2002 03:25:51 -0000	1.6
  +++ LoadFileTest.java	7 Mar 2002 19:42:30 -0000	1.7
  @@ -173,6 +173,17 @@
           }
       }
   
  +    /**
  +     * A unit test for JUnit
  +     */
  +    public void testStripJavaComments()
  +            throws BuildException {
  +        executeTarget("testStripJavaComments");
  +        String expected = project.getProperty("expected");
  +        if(!project.getProperty("testStripJavaComments").equals(expected)) {
  +            fail("StripJavaComments broken");
  +        }
  +    }
   
       /**
        * A unit test for JUnit
  
  
  

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


Mime
View raw message