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 Thu, 19 Feb 2004 11:01:20 GMT
peterreilly    2004/02/19 03:01:20

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs MacroInstance.java
               src/etc/testcases/taskdefs macrodef.xml
               src/testcases/org/apache/tools/ant/taskdefs
                        MacroDefTest.java
  Log:
  fix for macrodef broken @@ escape handling
  PR: 27069
  Reported by: Daniel Spilker
  
  Revision  Changes    Path
  1.546     +2 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.545
  retrieving revision 1.546
  diff -u -r1.545 -r1.546
  --- WHATSNEW	17 Feb 2004 15:48:17 -0000	1.545
  +++ WHATSNEW	19 Feb 2004 11:01:20 -0000	1.546
  @@ -19,6 +19,8 @@
   
   * subant haltonfailure=false did not catch all failures. Bugzilla Report 27007.
   
  +* macrodef @@ escaping was broken.  Bugzilla Report 27069.
  +
   Other changes:
   --------------
   
  
  
  
  1.23      +2 -14     ant/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
  
  Index: MacroInstance.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MacroInstance.java	9 Feb 2004 21:05:20 -0000	1.22
  +++ MacroInstance.java	19 Feb 2004 11:01:20 -0000	1.23
  @@ -130,7 +130,6 @@
       private static final int STATE_NORMAL         = 0;
       private static final int STATE_EXPECT_BRACKET = 1;
       private static final int STATE_EXPECT_NAME    = 2;
  -    private static final int STATE_EXPECT_EXCAPE  = 3;
   
       private String macroSubs(String s, Map macroMapping) {
           if (s == null) {
  @@ -155,7 +154,8 @@
                           state = STATE_EXPECT_NAME;
                           macroName = new StringBuffer();
                       } else if (ch == '@') {
  -                        state = STATE_EXPECT_EXCAPE;
  +                        state = STATE_NORMAL;
  +                        ret.append('@');
                       } else {
                           state = STATE_NORMAL;
                           ret.append('@');
  @@ -177,15 +177,6 @@
                           macroName.append(ch);
                       }
                       break;
  -                case STATE_EXPECT_EXCAPE:
  -                    state = STATE_NORMAL;
  -                    if (ch == '{') {
  -                        ret.append("@");
  -                    } else {
  -                        ret.append("@@");
  -                    }
  -                    ret.append(ch);
  -                    break;
                   default:
                       break;
               }
  @@ -199,9 +190,6 @@
               case STATE_EXPECT_NAME:
                   ret.append("@{");
                   ret.append(macroName.toString());
  -                break;
  -            case STATE_EXPECT_EXCAPE:
  -                ret.append("@@");
                   break;
               default:
                   break;
  
  
  
  1.10      +11 -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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- macrodef.xml	27 Jan 2004 17:43:25 -0000	1.9
  +++ macrodef.xml	19 Feb 2004 11:01:20 -0000	1.10
  @@ -145,4 +145,15 @@
         </sequential>
       </macrodef>
     </target>
  +
  +  <target name="escape">
  +    <macrodef name="escape">
  +      <attribute name="a"/>
  +      <attribute name="b"/>
  +      <sequential>
  +        <echo>a@b or a@@b is @{a}@@@{b}</echo>
  +      </sequential>
  +    </macrodef>
  +    <escape a="avalue" b="bvalue"/>
  +  </target>
   </project>
  
  
  
  1.14      +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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MacroDefTest.java	9 Feb 2004 21:05:41 -0000	1.13
  +++ MacroDefTest.java	19 Feb 2004 11:01:20 -0000	1.14
  @@ -99,5 +99,10 @@
               "duplicatetextname2",
               "the attribute name \"text\" has already been used by the text element");
       }
  +    public void testEscape() {
  +        expectLog(
  +            "escape",
  +            "a@b or a@b is avalue@bvalue");
  +    }
   }
   
  
  
  

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


Mime
View raw message