From f2e200153e5679e7eaf3fcabece54b448da72d5a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 25 Jul 2000 08:44:13 +0000 Subject: [PATCH] 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 --- build.xml | 2 + .../org/apache/tools/ant/AllJUnitTests.java | 2 - .../apache/tools/ant/types/AllJUnitTests.java | 2 + .../tools/ant/types/CommandlineJavaTest.java | 13 ++++++- .../{ => types}/EnumeratedAttributeTest.java | 4 +- .../tools/ant/{ => types}/PathTest.java | 38 ++++++++++++------- 6 files changed, 42 insertions(+), 19 deletions(-) rename src/testcases/org/apache/tools/ant/{ => types}/EnumeratedAttributeTest.java (98%) rename src/testcases/org/apache/tools/ant/{ => types}/PathTest.java (89%) diff --git a/build.xml b/build.xml index 775ca166f..c2b4b2855 100644 --- a/build.xml +++ b/build.xml @@ -259,6 +259,8 @@ + + diff --git a/src/testcases/org/apache/tools/ant/AllJUnitTests.java b/src/testcases/org/apache/tools/ant/AllJUnitTests.java index da10bbf29..e0496eb27 100644 --- a/src/testcases/org/apache/tools/ant/AllJUnitTests.java +++ b/src/testcases/org/apache/tools/ant/AllJUnitTests.java @@ -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; } diff --git a/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java b/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java index 3113b603d..57c5c7c12 100644 --- a/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java +++ b/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java @@ -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; } } diff --git a/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java b/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java index 1264276d4..aef1c414c 100644 --- a/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java +++ b/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java @@ -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]); diff --git a/src/testcases/org/apache/tools/ant/EnumeratedAttributeTest.java b/src/testcases/org/apache/tools/ant/types/EnumeratedAttributeTest.java similarity index 98% rename from src/testcases/org/apache/tools/ant/EnumeratedAttributeTest.java rename to src/testcases/org/apache/tools/ant/types/EnumeratedAttributeTest.java index 65ada8161..c9dc8a0fe 100644 --- a/src/testcases/org/apache/tools/ant/EnumeratedAttributeTest.java +++ b/src/testcases/org/apache/tools/ant/types/EnumeratedAttributeTest.java @@ -52,7 +52,9 @@ * . */ -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; diff --git a/src/testcases/org/apache/tools/ant/PathTest.java b/src/testcases/org/apache/tools/ant/types/PathTest.java similarity index 89% rename from src/testcases/org/apache/tools/ant/PathTest.java rename to src/testcases/org/apache/tools/ant/types/PathTest.java index 101bfbd76..76b71a854 100644 --- a/src/testcases/org/apache/tools/ant/PathTest.java +++ b/src/testcases/org/apache/tools/ant/types/PathTest.java @@ -52,7 +52,10 @@ * . */ -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); }