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 AntTest.java TypedefTest.java
Date Tue, 16 Jul 2002 13:06:46 GMT
bodewig     2002/07/16 06:06:46

  Modified:    .        WHATSNEW build.xml
               src/etc/testcases/taskdefs ant.xml
               src/main/org/apache/tools/ant DefaultLogger.java Main.java
                        Project.java
               src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
               src/main/org/apache/tools/ant/taskdefs Ant.java
               src/testcases/org/apache/tools/ant TopLevelTaskTest.java
               src/testcases/org/apache/tools/ant/taskdefs AntTest.java
                        TypedefTest.java
  Log:
  Move all top level elements to an implicit target named "" and make
  all othere targets depend on that one.
  
  As a side effect, <description> is now handled by ProjectHelperImpl,
  the data type has become unused.
  
  Revision  Changes    Path
  1.275     +5 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.274
  retrieving revision 1.275
  diff -u -r1.274 -r1.275
  --- WHATSNEW	12 Jul 2002 15:15:46 -0000	1.274
  +++ WHATSNEW	16 Jul 2002 13:06:45 -0000	1.275
  @@ -1,6 +1,11 @@
   Changes from Ant 1.5 to current CVS version
   ===========================================
   
  +Changes that could break older environments:
  +--------------------------------------------
  +
  +* Targets cannot have the empty string as their name any longer.
  +
   Fixed bugs:
   -----------
   
  
  
  
  1.311     +0 -14     jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.310
  retrieving revision 1.311
  diff -u -r1.310 -r1.311
  --- build.xml	12 Jul 2002 10:50:01 -0000	1.310
  +++ build.xml	16 Jul 2002 13:06:45 -0000	1.311
  @@ -328,20 +328,6 @@
     
     <!--
          ===================================================================
  -         Set up a patternsets that matches the parts of our JUnit testsuite
  -         that may be useful for task developers.
  -       ===================================================================
  -  -->
  -  <patternset id="useful.tests">
  -    <include name="${ant.package}/BuildFileTest*" />
  -    <include name="${regexp.package}/RegexpMatcherTest*" />
  -    <include name="${regexp.package}/RegexpTest*" />
  -    <include name="${optional.package}/AbstractXSLTLiaisonTest*" />
  -    <include name="${ant.package}/types/AbstractFileSetTest*" />
  -  </patternset>
  -
  -  <!--
  -       ===================================================================
            Check to see what optional dependencies are available
          ===================================================================
     -->
  
  
  
  1.9       +4 -0      jakarta-ant/src/etc/testcases/taskdefs/ant.xml
  
  Index: ant.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/ant.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ant.xml	22 Jun 2002 23:38:30 -0000	1.8
  +++ ant.xml	16 Jul 2002 13:06:45 -0000	1.9
  @@ -31,6 +31,10 @@
       <antcall target=""/>
     </target>
   
  +  <target name="test4b">
  +    <antcall target="does-not-exist"/>
  +  </target>
  +
     <target name="test5">
       <antcall target="dummy"/>
     </target>
  
  
  
  1.40      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
  
  Index: DefaultLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- DefaultLogger.java	22 Jun 2002 23:38:30 -0000	1.39
  +++ DefaultLogger.java	16 Jul 2002 13:06:45 -0000	1.40
  @@ -208,7 +208,8 @@
        *              Must not be <code>null</code>.
         */
       public void targetStarted(BuildEvent event) {
  -        if (Project.MSG_INFO <= msgOutputLevel) {
  +        if (Project.MSG_INFO <= msgOutputLevel
  +            && !event.getTarget().getName().equals("")) {
               String msg = StringUtils.LINE_SEP 
                   + event.getTarget().getName() + ":";
               printMessage(msg, out, event.getPriority());
  
  
  
  1.71      +9 -2      jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Main.java	15 Jul 2002 14:41:47 -0000	1.70
  +++ Main.java	16 Jul 2002 13:06:45 -0000	1.71
  @@ -604,8 +604,12 @@
                   }
   
                   // make sure that we have a target to execute
  -                if (targets.size() == 0 && project.getDefaultTarget() != null)
{
  -                    targets.addElement(project.getDefaultTarget());
  +                if (targets.size() == 0) {
  +                    if (project.getDefaultTarget() != null) {
  +                        targets.addElement(project.getDefaultTarget());
  +                    } else {
  +                        targets.addElement(""); // implicit target
  +                    }
                   }
   
                   project.executeTargets(targets);
  @@ -845,6 +849,9 @@
           while (ptargets.hasMoreElements()) {
               currentTarget = (Target) ptargets.nextElement();
               targetName = currentTarget.getName();
  +            if (targetName.equals("")) {
  +                continue;
  +            }
               targetDescription = currentTarget.getDescription();
               // maintain a sorted list of targets
               if (targetDescription == null) {
  
  
  
  1.111     +2 -2      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- Project.java	22 Jun 2002 23:38:30 -0000	1.110
  +++ Project.java	16 Jul 2002 13:06:45 -0000	1.111
  @@ -1773,7 +1773,7 @@
                   // no warning, this is not changing anything
                   return;
               }
  -            if (old != null) {
  +            if (old != null && !(old instanceof UnknownElement)) {
                   log("Overriding previous definition of reference to " + name,
                       MSG_WARN);
               }
  
  
  
  1.11      +113 -150  jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
  
  Index: ProjectHelperImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ProjectHelperImpl.java	15 Jul 2002 14:41:47 -0000	1.10
  +++ ProjectHelperImpl.java	16 Jul 2002 13:06:45 -0000	1.11
  @@ -108,6 +108,17 @@
        * Used for giving locations of errors etc.
        */
       private Locator locator;
  +    /**
  +     * Target that all other targets will depend upon implicitly.
  +     *
  +     * <p>This holds all tasks and data type definitions that have
  +     * been placed outside of targets.</p>
  +     */
  +    private Target implicitTarget = new Target();
  +
  +    public ProjectHelperImpl() {
  +        implicitTarget.setName("");
  +    }
   
       /**
        * Parses the project file, configuring the project as it goes.
  @@ -277,12 +288,6 @@
           }
   
           /**
  -         * Called when this element and all elements nested into it have been
  -         * handled.
  -         */
  -        protected void finished() {}
  -
  -        /**
            * Handles the end of an element. Any required clean-up is performed
            * by the finished() method and then the original handler is restored to
            * the parser.
  @@ -292,12 +297,8 @@
            *
            * @exception SAXException in case of error (not thrown in
            *                         this implementation)
  -         *
  -         * @see #finished()
            */
           public void endElement(String name) throws SAXException {
  -
  -            finished();
               // Let parent resume handling SAX events
               helperImpl.parser.setDocumentHandler(parentHandler);
           }
  @@ -451,7 +452,7 @@
                   }
               }
   
  -            if (def != null) {
  +            if (def != null && !def.equals("")) {
                   helperImpl.project.setDefaultTarget(def);
               }
   
  @@ -461,7 +462,7 @@
               }
   
               if (id != null) {
  -              helperImpl.project.addReference(id, helperImpl.project);
  +                helperImpl.project.addReference(id, helperImpl.project);
               }
   
               if (helperImpl.project.getProperty("basedir") != null) {
  @@ -480,6 +481,7 @@
                   }
               }
   
  +            helperImpl.project.addTarget("", helperImpl.implicitTarget);
           }
   
           /**
  @@ -500,33 +502,13 @@
           public void startElement(String name, AttributeList attrs) throws SAXParseException
{
               if (name.equals("target")) {
                   handleTarget(name, attrs);
  -            } else if (helperImpl.project.getDataTypeDefinitions().get(name) != null) {
  -                handleDataType(name, attrs);
  -            } else if (helperImpl.project.getTaskDefinitions().get(name) != null) {
  -                handleTask(name, attrs);
               } else {
  -                throw new SAXParseException("Unexpected element \"" + name + "\"", helperImpl.locator);
  +                handleElement(helperImpl, this, helperImpl.implicitTarget, 
  +                              name, attrs);
               }
           }
   
           /**
  -         * Handles a task by creating a task handler and initialising
  -         * is with the details of the element.
  -         *
  -         * @param name The name of the element to be handled.
  -         *            Will not be <code>null</code>.
  -         * @param attrs Attributes of the element to be handled.
  -         *              Will not be <code>null</code>.
  -         *
  -         * @exception SAXParseException if an error occurs when initialising
  -         *                              the task handler
  -         *
  -         */
  -        private void handleTask(String name, AttributeList attrs) throws SAXParseException
{
  -            (new TaskHandler(helperImpl, this, null, null, null)).init(name, attrs);
  -        }
  -
  -        /**
            * Handles a target defintion element by creating a target handler
            * and initialising is with the details of the element.
            *
  @@ -541,21 +523,6 @@
           private void handleTarget(String tag, AttributeList attrs) throws SAXParseException
{
               new TargetHandler(helperImpl, this).init(tag, attrs);
           }
  -        /**
  -         * Handles a data type defintion element by creating a data type
  -         * handler and initialising is with the details of the element.
  -         *
  -         * @param name The name of the element to be handled.
  -         *            Will not be <code>null</code>.
  -         * @param attrs Attributes of the element to be handled.
  -         *              Will not be <code>null</code>.
  -         *
  -         * @exception SAXParseException if an error occurs initialising
  -         *                              the handler
  -         */
  -        private void handleDataType(String name, AttributeList attrs) throws SAXParseException
{
  -            new DataTypeHandler(helperImpl, this).init(name, attrs);
  -        }
   
       }
   
  @@ -607,6 +574,10 @@
   
                   if (key.equals("name")) {
                       name = value;
  +                    if (name.equals("")) {
  +                        throw new BuildException("name attribute must not"
  +                                                 + " be empty");
  +                    }
                   } else if (key.equals("depends")) {
                       depends = value;
                   } else if (key.equals("if")) {
  @@ -628,6 +599,10 @@
               }
   
               target = new Target();
  +
  +            // implicit target must be first on dependency list
  +            target.addDependency("");
  +
               target.setName(name);
               target.setIf(ifCond);
               target.setUnless(unlessCond);
  @@ -657,12 +632,70 @@
            *                              the appropriate child handler
            */
           public void startElement(String name, AttributeList attrs) throws SAXParseException
{
  -            if (helperImpl.project.getDataTypeDefinitions().get(name) != null) {
  -                new DataTypeHandler(helperImpl, this, target).init(name, attrs);
  +            handleElement(helperImpl, this, target, name, attrs);
  +        }
  +    }
  +
  +    /**
  +     * Start a new DataTypeHandler if element is known to be a
  +     * data-type and a TaskHandler otherwise.
  +     *
  +     * <p>Factored out of TargetHandler.</p>
  +     *
  +     * @since Ant 1.6
  +     */
  +    private static void handleElement(ProjectHelperImpl helperImpl,
  +                                      DocumentHandler parent,
  +                                      Target target, String elementName,
  +                                      AttributeList attrs)
  +        throws SAXParseException {
  +        if (elementName.equals("description")) {
  +            new DescriptionHandler(helperImpl, parent);
  +        } else if (helperImpl.project.getDataTypeDefinitions()
  +                   .get(elementName) != null) {
  +            new DataTypeHandler(helperImpl, parent, target)
  +                .init(elementName, attrs);
  +        } else {
  +            new TaskHandler(helperImpl, parent, target, null, target)
  +                .init(elementName, attrs);
  +        }
  +    }
  +
  +    /**
  +     * Handler for "description" elements.
  +     */
  +    static class DescriptionHandler extends AbstractHandler {
  +
  +        /**
  +         * Constructor which just delegates to the superconstructor.
  +         *
  +         * @param parentHandler The handler which should be restored to the
  +         *                      parser at the end of the element.
  +         *                      Must not be <code>null</code>.
  +         */
  +        public DescriptionHandler(ProjectHelperImpl helperImpl, 
  +                                  DocumentHandler parentHandler) {
  +            super(helperImpl, parentHandler);
  +        }
  +
  +        /**
  +         * Adds the text as description to the project.
  +         *
  +         * @param buf A character array of the text within the element.
  +         *            Will not be <code>null</code>.
  +         * @param start The start element in the array.
  +         * @param count The number of characters to read from the array.
  +         */
  +        public void characters(char[] buf, int start, int count) {
  +            String text = new String(buf, start, count);
  +            String currentDescription = helperImpl.project.getDescription();
  +            if (currentDescription == null) {
  +                helperImpl.project.setDescription(text);
               } else {
  -                new TaskHandler(helperImpl, this, target, null, target).init(name, attrs);
  +                helperImpl.project.setDescription(currentDescription + text);
               }
           }
  +
       }
   
       /**
  @@ -701,18 +734,13 @@
            *                      Must not be <code>null</code>.
            *
            * @param container     Container for the element.
  -         *                      May be <code>null</code> if the target is
  -         *                      <code>null</code> as well. If the
  -         *                      target is <code>null</code>, this parameter
  -         *                      is effectively ignored.
  +         *                      Must not be <code>null</code>.
            *
            * @param parentWrapper Wrapper for the parent element, if any.
  -         *                      May be <code>null</code>. If the
  -         *                      target is <code>null</code>, this parameter
  -         *                      is effectively ignored.
  +         *                      May be <code>null</code>.
            *
            * @param target        Target this element is part of.
  -         *                      May be <code>null</code>.
  +         *                      Must not be <code>null</code>.
            */
           public TaskHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler,
                              TaskContainer container, RuntimeConfigurable parentWrapper,
Target target) {
  @@ -757,35 +785,18 @@
                                             helperImpl.locator.getColumnNumber()));
               helperImpl.configureId(task, attrs);
   
  -            // Top level tasks don't have associated targets
  -            if (target != null) {
  -                task.setOwningTarget(target);
  -                container.addTask(task);
  -                task.init();
  -                wrapper = task.getRuntimeConfigurableWrapper();
  -                wrapper.setAttributes(attrs);
  -                if (parentWrapper != null) {
  -                    parentWrapper.addChild(wrapper);
  -                }
  -            } else {
  -                task.init();
  -                configure(task, attrs, helperImpl.project);
  -            }
  -        }
  -
  -        /**
  -         * Executes the task if it is a top-level one.
  -         */
  -        protected void finished() {
  -            if (task != null && target == null) {
  -                task.execute();
  +            task.setOwningTarget(target);
  +            container.addTask(task);
  +            task.init();
  +            wrapper = task.getRuntimeConfigurableWrapper();
  +            wrapper.setAttributes(attrs);
  +            if (parentWrapper != null) {
  +                parentWrapper.addChild(wrapper);
               }
           }
   
           /**
  -         * Adds text to the task, using the wrapper if one is
  -         * available (in other words if the task is within a target)
  -         * or using addText otherwise.
  +         * Adds text to the task, using the wrapper.
            *
            * @param buf A character array of the text within the element.
            *            Will not be <code>null</code>.
  @@ -793,19 +804,9 @@
            * @param count The number of characters to read from the array.
            *
            * @exception SAXParseException if the element doesn't support text
  -         *
  -         * @see ProjectHelper#addText(Project,Object,char[],int,int)
            */
  -        public void characters(char[] buf, int start, int count) throws SAXParseException
{
  -            if (wrapper == null) {
  -                try {
  -                    ProjectHelper.addText(helperImpl.project, task, buf, start, count);
  -                } catch (BuildException exc) {
  -                    throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
  -                }
  -            } else {
  -                wrapper.addText(buf, start, count);
  -            }
  +        public void characters(char[] buf, int start, int count) {
  +            wrapper.addText(buf, start, count);
           }
   
           /**
  @@ -867,10 +868,10 @@
            *                      Must not be <code>null</code>.
            *
            * @param parentWrapper Wrapper for the parent element, if any.
  -         *                      May be <code>null</code>.
  +         *                      Must not be <code>null</code>.
            *
            * @param target        Target this element is part of.
  -         *                      May be <code>null</code>.
  +         *                      Must not be <code>null</code>.
            */
           public NestedElementHandler(ProjectHelperImpl helperImpl,
                                       DocumentHandler parentHandler,
  @@ -922,22 +923,16 @@
   
                   helperImpl.configureId(child, attrs);
   
  -                if (parentWrapper != null) {
  -                    childWrapper = new RuntimeConfigurable(child, propType);
  -                    childWrapper.setAttributes(attrs);
  -                    parentWrapper.addChild(childWrapper);
  -                } else {
  -                    configure(child, attrs, helperImpl.project);
  -                    ih.storeElement(helperImpl.project, parent, child, elementName);
  -                }
  +                childWrapper = new RuntimeConfigurable(child, propType);
  +                childWrapper.setAttributes(attrs);
  +                parentWrapper.addChild(childWrapper);
               } catch (BuildException exc) {
                   throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
               }
           }
   
           /**
  -         * Adds text to the element, using the wrapper if one is
  -         * available or using addText otherwise.
  +         * Adds text to the element, using the wrapper.
            *
            * @param buf A character array of the text within the element.
            *            Will not be <code>null</code>.
  @@ -945,19 +940,9 @@
            * @param count The number of characters to read from the array.
            *
            * @exception SAXParseException if the element doesn't support text
  -         *
  -         * @see ProjectHelper#addText(Project,Object,char[],int,int)
            */
  -        public void characters(char[] buf, int start, int count) throws SAXParseException
{
  -            if (parentWrapper == null) {
  -                try {
  -                    ProjectHelper.addText(helperImpl.project, child, buf, start, count);
  -                } catch (BuildException exc) {
  -                    throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
  -                }
  -            } else {
  -                childWrapper.addText(buf, start, count);
  -            }
  +        public void characters(char[] buf, int start, int count) {
  +            childWrapper.addText(buf, start, count);
           }
   
           /**
  @@ -998,17 +983,6 @@
           private RuntimeConfigurable wrapper = null;
   
           /**
  -         * Constructor with no target specified.
  -         *
  -         * @param parentHandler The handler which should be restored to the
  -         *                      parser at the end of the element.
  -         *                      Must not be <code>null</code>.
  -         */
  -        public DataTypeHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler)
{
  -            this(helperImpl, parentHandler, null);
  -        }
  -
  -        /**
            * Constructor with a target specified.
            *
            * @param parentHandler The handler which should be restored to the
  @@ -1016,7 +990,7 @@
            *                      Must not be <code>null</code>.
            *
            * @param target The parent target of this element.
  -         *               May be <code>null</code>.
  +         *               Must not be <code>null</code>.
            */
           public DataTypeHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler,
Target target) {
               super(helperImpl, parentHandler);
  @@ -1046,23 +1020,16 @@
                       throw new BuildException("Unknown data type " + propType);
                   }
   
  -                if (target != null) {
  -                    wrapper = new RuntimeConfigurable(element, propType);
  -                    wrapper.setAttributes(attrs);
  -                    target.addDataType(wrapper);
  -                } else {
  -                    configure(element, attrs, helperImpl.project);
  -                    helperImpl.configureId(element, attrs);
  -                }
  +                wrapper = new RuntimeConfigurable(element, propType);
  +                wrapper.setAttributes(attrs);
  +                target.addDataType(wrapper);
               } catch (BuildException exc) {
                   throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
               }
           }
   
  -        // XXX: (Jon Skeet) Any reason why this doesn't use the wrapper
  -        // if one is available, whereas NestedElementHandler.characters does?
           /**
  -         * Adds text to the element.
  +         * Adds text to the using the wrapper.
            *
            * @param buf A character array of the text within the element.
            *            Will not be <code>null</code>.
  @@ -1073,12 +1040,8 @@
            *
            * @see ProjectHelper#addText(Project,Object,char[],int,int)
            */
  -        public void characters(char[] buf, int start, int count) throws SAXParseException
{
  -            try {
  -                ProjectHelper.addText(helperImpl.project, element, buf, start, count);
  -            } catch (BuildException exc) {
  -                throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
  -            }
  +        public void characters(char[] buf, int start, int count) {
  +            wrapper.addText(buf, start, count);
           }
   
           /**
  
  
  
  1.62      +8 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- Ant.java	15 Jul 2002 14:41:47 -0000	1.61
  +++ Ant.java	16 Jul 2002 13:06:45 -0000	1.62
  @@ -360,7 +360,8 @@
               // the build file if this is a top level task)?
               if (newProject.getBaseDir().equals(project.getBaseDir()) &&
                   newProject.getProperty("ant.file").equals(project.getProperty("ant.file"))
  -                && (getOwningTarget() == null ||
  +                && getOwningTarget() != null
  +                && (getOwningTarget().getName().equals("") ||
                       getOwningTarget().getName().equals(target))) {
                   throw new BuildException("ant task calling its own parent "
                                            + "target");
  @@ -370,6 +371,8 @@
   
               if (target != null) {
                   newProject.executeTarget(target);
  +            } else {
  +                newProject.executeTarget("");
               }
           } finally {
               // help the gc
  @@ -518,6 +521,10 @@
        * Defaults to the new project's default target.
        */
       public void setTarget(String s) {
  +        if (s.equals("")) {
  +            throw new BuildException("target attribute must not be empty");
  +        }
  +        
           this.target = s;
       }
   
  
  
  
  1.2       +2 -2      jakarta-ant/src/testcases/org/apache/tools/ant/TopLevelTaskTest.java
  
  Index: TopLevelTaskTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/TopLevelTaskTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TopLevelTaskTest.java	15 Jul 2002 14:41:47 -0000	1.1
  +++ TopLevelTaskTest.java	16 Jul 2002 13:06:45 -0000	1.2
  @@ -68,12 +68,12 @@
   
       public void testNoTarget() {
           configureProject("src/etc/testcases/core/topleveltasks/notarget.xml");
  -        assertEquals("Called", getLog());
  +        expectLog("", "Called");
       }
   
       public void testCalledFromTopLevelAnt() {
           configureProject("src/etc/testcases/core/topleveltasks/toplevelant.xml");
  -        assertEquals("Called", getLog());
  +        expectLog("", "Called");
       }
   
       public void testCalledFromTargetLevelAnt() {
  
  
  
  1.14      +15 -2     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java
  
  Index: AntTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AntTest.java	22 Jun 2002 23:38:37 -0000	1.13
  +++ AntTest.java	16 Jul 2002 13:06:46 -0000	1.14
  @@ -99,7 +99,11 @@
       }
   
       public void test4() {
  -        expectBuildException("test4", "target doesn't exist");
  +        expectBuildException("test4", "target attribute must not be empty");
  +    }
  +
  +    public void test4b() {
  +        expectBuildException("test4b", "target doesn't exist");
       }
   
       public void test5() {
  @@ -308,6 +312,9 @@
           public void messageLogged(BuildEvent event) {}
   
           public void targetStarted(BuildEvent event) {
  +            if (event.getTarget().getName().equals("")) {
  +                return;
  +            }
               if (error == null) {
                   try {
                       assertEquals(expectedBasedirs[calls++],
  @@ -345,6 +352,9 @@
           public void messageLogged(BuildEvent event) {}
   
           public void targetStarted(BuildEvent event) {
  +            if (event.getTarget().getName().equals("")) {
  +                return;
  +            }
               if (error == null) {
                   try {
                       String msg =
  @@ -457,6 +467,9 @@
           public void messageLogged(BuildEvent event) {}
   
           public void targetStarted(BuildEvent event) {
  +            if (event.getTarget().getName().equals("")) {
  +                return;
  +            }
               if (error == null) {
                   try {
                       assertEquals(expectedValues[calls++],
  
  
  
  1.3       +3 -4      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/TypedefTest.java
  
  Index: TypedefTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/TypedefTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypedefTest.java	14 Nov 2001 12:25:30 -0000	1.2
  +++ TypedefTest.java	16 Jul 2002 13:06:46 -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
  @@ -97,8 +97,7 @@
       }
   
       public void testLocal() {
  -        expectLog("testLocal", 
  -                  "Overriding previous definition of reference to local");
  +        expectLog("testLocal", "");
           Object ref = project.getReferences().get("local");
           assertNotNull("ref is not null", ref);
           assertEquals("org.example.types.TypedefTestType",
  
  
  

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