ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional ReplaceRegExpTest.java
Date Mon, 16 Sep 2002 16:19:30 GMT
bodewig     2002/09/16 09:19:30

  Modified:    src/etc/testcases/taskdefs/optional replaceregexp.xml
               src/main/org/apache/tools/ant/taskdefs/optional
                        ReplaceRegExp.java
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        ReplaceRegExpTest.java
  Added:       src/etc/testcases/taskdefs/optional
                        replaceregexp2.properties
                        replaceregexp2.result.properties
  Log:
  Don't add extra linefeed in <replaceregexp>
  
  PR: 12407
  Submitted by:	Stefan Moebius <stmoebius at yahoo.com>
  
  Note that the byline="true" case is still broken (and a commented-out
  test confirms this) - I'll look into it later this week.
  
  Revision  Changes    Path
  1.4       +18 -0     jakarta-ant/src/etc/testcases/taskdefs/optional/replaceregexp.xml
  
  Index: replaceregexp.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/optional/replaceregexp.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- replaceregexp.xml	19 Feb 2002 16:48:47 -0000	1.3
  +++ replaceregexp.xml	16 Sep 2002 16:19:29 -0000	1.4
  @@ -8,7 +8,25 @@
       <copy file="replaceregexp.properties" tofile="test.properties" />
     </target>
   
  +  <target name="setup-nl">
  +    <copy file="replaceregexp2.properties" tofile="test.properties" />
  +  </target>
  +
     <target name="testReplace" depends="setup">
  +    <replaceregexp file="test.properties" byline="true">
  +      <regexp pattern="Old(.*)=(.*)" />
  +      <substitution expression="NewProp=\1\2" />
  +    </replaceregexp>
  +  </target>
  +
  +  <target name="testDontAddNewline1" depends="setup-nl">
  +    <replaceregexp file="test.properties" byline="false">
  +      <regexp pattern="Old(.*)=(.*)" />
  +      <substitution expression="NewProp=\1\2" />
  +    </replaceregexp>
  +  </target>
  +
  +  <target name="testDontAddNewline2" depends="setup-nl">
       <replaceregexp file="test.properties" byline="true">
         <regexp pattern="Old(.*)=(.*)" />
         <substitution expression="NewProp=\1\2" />
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/replaceregexp2.properties
  
  Index: replaceregexp2.properties
  ===================================================================
  OldAbc=Def
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/replaceregexp2.result.properties
  
  Index: replaceregexp2.result.properties
  ===================================================================
  NewProp=AbcDef
  
  
  1.14      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
  
  Index: ReplaceRegExp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ReplaceRegExp.java	25 Jul 2002 15:21:11 -0000	1.13
  +++ ReplaceRegExp.java	16 Sep 2002 16:19:29 -0000	1.14
  @@ -354,7 +354,7 @@
                       changes = true;
                   }
   
  -                pw.println(res);
  +                pw.print(res);
                   pw.flush();
               }
   
  
  
  
  1.3       +26 -2     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
  
  Index: ReplaceRegExpTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ReplaceRegExpTest.java	14 Nov 2001 12:25:31 -0000	1.2
  +++ ReplaceRegExpTest.java	16 Sep 2002 16:19:30 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    *  The Apache Software License, Version 1.1
    *
  - *  Copyright (c) 2001 The Apache Software Foundation.  All rights
  + *  Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    *  reserved.
    *
    *  Redistribution and use in source and binary forms, with or without
  @@ -54,8 +54,10 @@
   package org.apache.tools.ant.taskdefs.optional;
   
   import org.apache.tools.ant.BuildFileTest;
  +import org.apache.tools.ant.util.FileUtils;
   
   import java.util.Properties;
  +import java.io.File;
   import java.io.FileInputStream;
   import java.io.IOException;
   
  @@ -110,5 +112,27 @@
           assertNull(after.get("OldAbc"));
           assertEquals("AbcDef", after.get("NewProp"));
       }
  +
  +    public void testDontAddNewline1() throws IOException {
  +        executeTarget("testDontAddNewline1");
  +        assertTrue("Files match",
  +                   FileUtils.newFileUtils()
  +                   .contentEquals(new File("src/etc/testcases/taskdefs/optional/test.properties"),
  +                                  new File("src/etc/testcases/taskdefs/optional/replaceregexp2.result.properties")));
  +    }
  +
  +    /**
  +     * FIXME
  +     *
  +     * will be fixed this week, just running out of time and
  +     * committing a partly fixed version now -- Stefan
  +    public void testDontAddNewline2() throws IOException {
  +        executeTarget("testDontAddNewline2");
  +        assertTrue("Files match",
  +                   FileUtils.newFileUtils()
  +                   .contentEquals(new File("src/etc/testcases/taskdefs/optional/test.properties"),
  +                                  new File("src/etc/testcases/taskdefs/optional/replaceregexp2.result.properties")));
  +    }
  +     */
   
   }// ReplaceRegExpTest
  
  
  

--
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