Browse Source

Changed testcases to reflect the new packages of Path and

EnumeratedAttribute.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267832 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
f2e200153e
6 changed files with 42 additions and 19 deletions
  1. +2
    -0
      build.xml
  2. +0
    -2
      src/testcases/org/apache/tools/ant/AllJUnitTests.java
  3. +2
    -0
      src/testcases/org/apache/tools/ant/types/AllJUnitTests.java
  4. +11
    -2
      src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java
  5. +3
    -1
      src/testcases/org/apache/tools/ant/types/EnumeratedAttributeTest.java
  6. +24
    -14
      src/testcases/org/apache/tools/ant/types/PathTest.java

+ 2
- 0
build.xml View File

@@ -259,6 +259,8 @@
<exclude name="**/EnumeratedAttributeTest.java" unless="junit.present" />
<exclude name="**/IntrospectionHelperTest.java" unless="junit.present" />
<exclude name="**/PathTest.java" unless="junit.present" />
<exclude name="**/CommandlineTest.java" unless="junit.present" />
<exclude name="**/CommandlineJavaTest.java" unless="junit.present" />
</javac>
</target>



+ 0
- 2
src/testcases/org/apache/tools/ant/AllJUnitTests.java View File

@@ -71,8 +71,6 @@ public class AllJUnitTests extends TestCase {

public static Test suite() {
TestSuite suite = new TestSuite(IntrospectionHelperTest.class);
suite.addTest(new TestSuite(EnumeratedAttributeTest.class));
suite.addTest(new TestSuite(PathTest.class));
suite.addTest(org.apache.tools.ant.types.AllJUnitTests.suite());
return suite;
}


+ 2
- 0
src/testcases/org/apache/tools/ant/types/AllJUnitTests.java View File

@@ -72,6 +72,8 @@ public class AllJUnitTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(CommandlineTest.class);
suite.addTest(new TestSuite(CommandlineJavaTest.class));
suite.addTest(new TestSuite(EnumeratedAttributeTest.class));
suite.addTest(new TestSuite(PathTest.class));
return suite;
}
}

+ 11
- 2
src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java View File

@@ -54,6 +54,8 @@

package org.apache.tools.ant.types;

import org.apache.tools.ant.Project;

import junit.framework.TestCase;
import junit.framework.AssertionFailedError;

@@ -70,6 +72,13 @@ public class CommandlineJavaTest extends TestCase {
super(name);
}

private Project project;

public void setUp() {
project = new Project();
project.setBasedir(".");
}

public void testGetCommandline() {
CommandlineJava c = new CommandlineJava();
c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
@@ -83,8 +92,8 @@ public class CommandlineJavaTest extends TestCase {
assertEquals("no classpath",
"org.apache.tools.ant.CommandlineJavaTest", s[3]);

c.createClasspath().setLocation("junit.jar");
c.createClasspath().setLocation("ant.jar");
c.createClasspath(project).setLocation("junit.jar");
c.createClasspath(project).setLocation("ant.jar");
s = c.getCommandline();
assertEquals("with classpath", 6, s.length);
assertEquals("with classpath", "java", s[0]);


src/testcases/org/apache/tools/ant/EnumeratedAttributeTest.java → src/testcases/org/apache/tools/ant/types/EnumeratedAttributeTest.java View File

@@ -52,7 +52,9 @@
* <http://www.apache.org/>.
*/

package org.apache.tools.ant;
package org.apache.tools.ant.types;

import org.apache.tools.ant.BuildException;

import junit.framework.TestCase;
import junit.framework.AssertionFailedError;

src/testcases/org/apache/tools/ant/PathTest.java → src/testcases/org/apache/tools/ant/types/PathTest.java View File

@@ -52,7 +52,10 @@
* <http://www.apache.org/>.
*/

package org.apache.tools.ant;
package org.apache.tools.ant.types;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;

import junit.framework.TestCase;
import junit.framework.AssertionFailedError;
@@ -69,13 +72,20 @@ public class PathTest extends TestCase {

public static boolean isUnixStyle = File.pathSeparatorChar == ':';

private Project project;

public PathTest(String name) {
super(name);
}

public void setUp() {
project = new Project();
project.setBasedir(".");
}

// actually tests constructor as well as setPath
public void testConstructor() {
Path p = new Path("/a:/b");
Path p = new Path(project, "/a:/b");
String[] l = p.list();
assertEquals("two items, Unix style", 2, l.length);
if (isUnixStyle) {
@@ -86,7 +96,7 @@ public class PathTest extends TestCase {
assertEquals("\\b", l[1]);
}

p = new Path("\\a;\\b");
p = new Path(project, "\\a;\\b");
l = p.list();
assertEquals("two items, DOS style", 2, l.length);
if (isUnixStyle) {
@@ -97,7 +107,7 @@ public class PathTest extends TestCase {
assertEquals("\\b", l[1]);
}

p = new Path("\\a;\\b:/c");
p = new Path(project, "\\a;\\b:/c");
l = p.list();
assertEquals("three items, mixed style", 3, l.length);
if (isUnixStyle) {
@@ -110,7 +120,7 @@ public class PathTest extends TestCase {
assertEquals("\\c", l[2]);
}

p = new Path("c:\\test");
p = new Path(project, "c:\\test");
l = p.list();
if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length);
@@ -121,7 +131,7 @@ public class PathTest extends TestCase {
assertEquals("c:\\test", l[0]);
}

p = new Path("c:/test");
p = new Path(project, "c:/test");
l = p.list();
if (isUnixStyle) {
assertEquals("no drives on Unix", 2, l.length);
@@ -134,7 +144,7 @@ public class PathTest extends TestCase {
}

public void testSetLocation() {
Path p = new Path();
Path p = new Path(project);
p.setLocation("/a");
String[] l = p.list();
if (isUnixStyle) {
@@ -145,7 +155,7 @@ public class PathTest extends TestCase {
assertEquals("\\a", l[0]);
}

p = new Path();
p = new Path(project);
p.setLocation("\\a");
l = p.list();
if (isUnixStyle) {
@@ -158,7 +168,7 @@ public class PathTest extends TestCase {
}

public void testAppending() {
Path p = new Path("/a:/b");
Path p = new Path(project, "/a:/b");
String[] l = p.list();
assertEquals("2 after construction", 2, l.length);
p.setLocation("/c");
@@ -167,13 +177,13 @@ public class PathTest extends TestCase {
p.setPath("\\d;\\e");
l = p.list();
assertEquals("5 after setPath", 5, l.length);
p.append(new Path("\\f"));
p.append(new Path(project, "\\f"));
l = p.list();
assertEquals("6 after append", 6, l.length);
}

public void testEmpyPath() {
Path p = new Path("");
Path p = new Path(project, "");
String[] l = p.list();
assertEquals("0 after construction", 0, l.length);
p.setLocation("");
@@ -182,13 +192,13 @@ public class PathTest extends TestCase {
p.setPath("");
l = p.list();
assertEquals("0 after setPath", 0, l.length);
p.append(new Path());
p.append(new Path(project));
l = p.list();
assertEquals("0 after append", 0, l.length);
}

public void testUnique() {
Path p = new Path("/a:/a");
Path p = new Path(project, "/a:/a");
String[] l = p.list();
assertEquals("1 after construction", 1, l.length);
p.setLocation("\\a");
@@ -197,7 +207,7 @@ public class PathTest extends TestCase {
p.setPath("\\a;/a");
l = p.list();
assertEquals("1 after setPath", 1, l.length);
p.append(new Path("/a;\\a:\\a"));
p.append(new Path(project, "/a;\\a:\\a"));
l = p.list();
assertEquals("1 after append", 1, l.length);
}

Loading…
Cancel
Save