ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs AvailableTest.java
Date Tue, 01 May 2001 11:41:06 GMT
nico        01/05/01 04:41:06

  Modified:    src/etc/testcases/taskdefs available.xml
               src/testcases/org/apache/tools/ant/taskdefs
                        AvailableTest.java
  Log:
  - Added new tests for the dir-attribute
  - Adjusted expected result for test13 - empty string is not a file
  - Corrected all the tests - seems I have got the arguments in the wrong
    order on first submission :-(
  
  Revision  Changes    Path
  1.5       +15 -0     jakarta-ant/src/etc/testcases/taskdefs/available.xml
  
  Index: available.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/available.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- available.xml	2001/01/08 16:40:43	1.4
  +++ available.xml	2001/05/01 11:41:04	1.5
  @@ -78,4 +78,19 @@
                  classname="org.apache.tools.ant.taskdefs.this_class_does_not_exist"/>
     </target>
   
  +  <target name="test16">
  +    <available property="test" 
  +               dir=""/>
  +  </target>
  +
  +  <target name="test17">
  +    <available property="test" 
  +               dir="../taskdefs"/>
  +  </target>
  +
  +  <target name="test18">
  +    <available property="test" 
  +               dir="../this_dir_should_never_exist"/>
  +  </target>
  +
   </project>
  
  
  
  1.3       +30 -10    jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AvailableTest.java
  
  Index: AvailableTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AvailableTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AvailableTest.java	2001/01/03 14:18:48	1.2
  +++ AvailableTest.java	2001/05/01 11:41:05	1.3
  @@ -91,7 +91,7 @@
       // file does exist -> property 'test' == 'true'
       public void test5() { 
           executeTarget("test5");
  -        assertEquals(project.getProperty("test"), "true");
  +        assertEquals("true", project.getProperty("test"));
       }
       
       // resource doesn't exist -> property 'test' == null
  @@ -103,7 +103,7 @@
       // resource does exist -> property 'test' == 'true'
       public void test7() { 
           executeTarget("test7");
  -        assertEquals(project.getProperty("test"), "true");
  +        assertEquals("true", project.getProperty("test"));
       }
   
       // class doesn't exist -> property 'test' == null
  @@ -115,32 +115,32 @@
       // class does exist -> property 'test' == 'true'
       public void test9() { 
           executeTarget("test9");
  -        assertEquals(project.getProperty("test"), "true");
  +        assertEquals("true", project.getProperty("test"));
       }
       
       // All three specified and all three exist -> true
       public void test10() { 
           executeTarget("test10");
  -        assertEquals(project.getProperty("test"), "true");
  +        assertEquals("true", project.getProperty("test"));
       }
   
       // All three specified but class missing -> null
       public void test11() { 
           executeTarget("test11");
  -        assertEquals(project.getProperty("test"), null);
  +        assertEquals(null, project.getProperty("test"));
       }
   
       // Specified property-name is "" -> true
       public void test12() { 
           executeTarget("test12");
  -        assertEquals(project.getProperty("test"), null);
  -        assertEquals(project.getProperty(""), "true");
  +        assertEquals(null, project.getProperty("test"));
  +        assertEquals("true", project.getProperty(""));
       }
   
  -    // Specified file is "" -> current directory should always exis :-)
  +    // Specified file is "" -> invalid files do not exist
       public void test13() { 
           executeTarget("test13");
  -        assertEquals(project.getProperty("test"), "true");
  +        assertEquals(null, project.getProperty("test"));
       }
   
       // Specified resource is "" -> can such a thing exist?
  @@ -155,6 +155,26 @@
       // Specified class is "" -> can not exist
       public void test15() { 
           executeTarget("test15");
  -        assertEquals(project.getProperty("test"), null);
  +        assertEquals(null, project.getProperty("test"));
  +    }
  +
  +    // Specified dir is "" -> this is the current directory and should
  +    // always exist
  +    public void test16() { 
  +        executeTarget("test16");
  +        assertEquals("true", project.getProperty("test"));
  +    }
  +
  +    // Specified dir is "../taskdefs" -> should exist since it's the 
  +    // location of the buildfile used...
  +    public void test17() { 
  +        executeTarget("test17");
  +        assertEquals("true", project.getProperty("test"));
  +    }
  +
  +    // Specified dir is "../this_dir_should_never_exist" -> null
  +    public void test18() { 
  +        executeTarget("test18");
  +        assertEquals(null, project.getProperty("test"));
       }
   }
  
  
  

Mime
View raw message