summaryrefslogtreecommitdiff
path: root/src/testcases
diff options
context:
space:
mode:
authorPeter Reilly <peterreilly@apache.org>2003-11-03 16:36:19 +0000
committerPeter Reilly <peterreilly@apache.org>2003-11-03 16:36:19 +0000
commit23bebfbdc21ac3706aaa3d84210c900c867d0f21 (patch)
tree65bbbe05449d4fcffb78cdfad182d5eb4918e239 /src/testcases
parentbc41ca3c90547e235875442009e703ccf4c93244 (diff)
downloadant-23bebfbdc21ac3706aaa3d84210c900c867d0f21.tar.gz
make error message for bad imports a little better
When an buildexception is reported in the imported xml, add the importer xml file to the build exception git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275610 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java b/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
index d161e2e67..cfd07f025 100644
--- a/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
+++ b/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
@@ -54,7 +54,9 @@
package org.apache.tools.ant.taskdefs;
+import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
/**
@@ -119,5 +121,27 @@ public class ImportTest extends BuildFileTest {
expectPropertySet("within-imported", "foo", "bar");
assertNotNull(getProject().getReference("baz"));
}
+
+ public void testImportError() {
+ try {
+ configureProject(
+ "src/etc/testcases/taskdefs/import/import_bad_import.xml");
+ } catch (BuildException ex) {
+ Location lo = ex.getLocation();
+ assertTrue(
+ "expected location of build exception to be set",
+ (lo != null));
+ assertTrue(
+ "expected location to contain calling file",
+ lo.getFileName().indexOf("import_bad_import.xml") != -1);
+ assertTrue(
+ "expected message of ex to contain called file",
+ ex.getMessage().indexOf("bad.xml") != -1);
+ return;
+ }
+ assertTrue(
+ "Did not see build exception",
+ false);
+ }
}