ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs MacroDefTest.java
Date Mon, 30 May 2005 10:05:41 GMT
peterreilly    2005/05/30 03:05:41

  Modified:    .        Tag: ANT_16_BRANCH WHATSNEW
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        MacroDef.java
               src/etc/testcases/taskdefs Tag: ANT_16_BRANCH macrodef.xml
               src/testcases/org/apache/tools/ant/taskdefs Tag:
                        ANT_16_BRANCH MacroDefTest.java
  Log:
  sync fix for 35109
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.503.2.232 +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.231
  retrieving revision 1.503.2.232
  diff -u -r1.503.2.231 -r1.503.2.232
  --- WHATSNEW	20 May 2005 16:13:46 -0000	1.503.2.231
  +++ WHATSNEW	30 May 2005 10:05:40 -0000	1.503.2.232
  @@ -10,6 +10,9 @@
   * <move> was unable to replace existing files or write into
     existing directories.  Bugzilla report 34962.
   
  +* <macrodef> with redefined default values was incorrect. (Fix for
  +   31215 had a bug). Bugzilla report 35109.
  +
   Changes from Ant 1.6.3 to Ant 1.6.4
   ===================================
   
  
  
  
  No                   revision
  No                   revision
  1.7.2.22  +26 -4     ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  
  Index: MacroDef.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
  retrieving revision 1.7.2.21
  retrieving revision 1.7.2.22
  diff -u -r1.7.2.21 -r1.7.2.22
  --- MacroDef.java	15 Mar 2005 15:11:24 -0000	1.7.2.21
  +++ MacroDef.java	30 May 2005 10:05:41 -0000	1.7.2.22
  @@ -622,13 +622,14 @@
       }
   
       /**
  -     * similar equality method for macrodef, ignores project and
  +     * same or similar equality method for macrodef, ignores project and
        * runtime info.
        *
        * @param obj an <code>Object</code> value
  +     * @param same if true test for sameness, otherwise just similiar
        * @return a <code>boolean</code> value
        */
  -    public boolean similar(Object obj) {
  +    private boolean sameOrSimilar(Object obj, boolean same) {
           if (obj == this) {
               return true;
           }
  @@ -649,7 +650,8 @@
           // Allow two macro definitions with the same location
           // to be treated as similar - bugzilla 31215
           if (other.getLocation() != null
  -            && other.getLocation().equals(getLocation())) {
  +            && other.getLocation().equals(getLocation())
  +            && !same) {
               return true;
           }
           if (text == null) {
  @@ -686,6 +688,26 @@
       }
   
       /**
  +     * Similar method for this definition
  +     *
  +     * @param obj another definition
  +     * @return true if the definitions are similar
  +     */
  +    public boolean similar(Object obj) {
  +        return sameOrSimilar(obj, false);
  +    }
  +
  +    /**
  +     * Equality method for this definition
  +     *
  +     * @param obj another definition
  +     * @return true if the definitions are the same
  +     */
  +    public boolean sameDefinition(Object obj) {
  +        return sameOrSimilar(obj, true);
  +    }
  +
  +    /**
        * extends AntTypeDefinition, on create
        * of the object, the template macro definition
        * is given.
  @@ -729,7 +751,7 @@
                   return false;
               }
               MyAntTypeDefinition otherDef = (MyAntTypeDefinition) other;
  -            return macroDef.similar(otherDef.macroDef);
  +            return macroDef.sameDefinition(otherDef.macroDef);
           }
   
           /**
  
  
  
  No                   revision
  No                   revision
  1.2.2.11  +17 -0     ant/src/etc/testcases/taskdefs/macrodef.xml
  
  Index: macrodef.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/macrodef.xml,v
  retrieving revision 1.2.2.10
  retrieving revision 1.2.2.11
  diff -u -r1.2.2.10 -r1.2.2.11
  --- macrodef.xml	4 Jun 2004 07:39:08 -0000	1.2.2.10
  +++ macrodef.xml	30 May 2005 10:05:41 -0000	1.2.2.11
  @@ -220,7 +220,24 @@
           <explicit/>
         </sequential>
       </macrodef>
  +  </target>
  +
  +  <property name="default.override" value="old"/>
  +  <macrodef name="simple.override">
  +    <attribute name="attr" default="${default.override}"/>
  +    <sequential>
  +      <echo>value is @{attr}</echo>
  +    </sequential>
  +  </macrodef>
  +
  +  <target name="override.default">
  +    <antcall target="override.call">
  +      <param name="default.override" value="new"/>
  +    </antcall>
  +  </target>
   
  +  <target name="override.call">
  +    <simple.override/>
     </target>
   
   </project>
  
  
  
  No                   revision
  No                   revision
  1.2.2.15  +5 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java
  
  Index: MacroDefTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java,v
  retrieving revision 1.2.2.14
  retrieving revision 1.2.2.15
  diff -u -r1.2.2.14 -r1.2.2.15
  --- MacroDefTest.java	4 Jun 2004 07:39:09 -0000	1.2.2.14
  +++ MacroDefTest.java	30 May 2005 10:05:41 -0000	1.2.2.15
  @@ -108,6 +108,11 @@
               "attribute.description",
               "description is hello world");
       }
  +    public void testOverrideDefault() {
  +        expectLog(
  +            "override.default",
  +            "value is new");
  +    }
       public void testImplicit() {
           expectLog(
               "implicit", "Before implicitIn implicitAfter implicit");
  
  
  

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


Mime
View raw message