| Index: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/utilities/ast/DartElementLocatorTest.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/utilities/ast/DartElementLocatorTest.java b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/utilities/ast/DartElementLocatorTest.java
|
| index b4bfafc3d25b8d6ca0e8bbb6586c83235516e467..b00267437e98af6135d25502c9d1dcad03be0888 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/utilities/ast/DartElementLocatorTest.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/utilities/ast/DartElementLocatorTest.java
|
| @@ -208,6 +208,90 @@ public class DartElementLocatorTest extends TestCase {
|
| }
|
| }
|
|
|
| + /**
|
| + * Test for {@link DartImport}.
|
| + */
|
| + public void test_DartImport_onPrefixUsage_inFieldReference() throws Exception {
|
| + TestProject testProject = new TestProject("Test");
|
| + try {
|
| + IResource libResourceA = testProject.setUnitContent(
|
| + "LibA.dart",
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "#library('libA');",
|
| + "var field;",
|
| + "")).getResource();
|
| + IResource resourceTest = testProject.setUnitContent(
|
| + "TestC.dart",
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "#library('Test');",
|
| + "#import('LibA.dart', prefix: 'aaa');",
|
| + "f() {",
|
| + " aaa.field = 0;",
|
| + "}",
|
| + "")).getResource();
|
| + TestProject.waitForAutoBuild();
|
| + DartLibrary libraryA = testProject.getDartProject().getDartLibrary(libResourceA);
|
| + DartLibrary libraryTest = testProject.getDartProject().getDartLibrary(resourceTest);
|
| + // usage of "aaa" = "libraryA"
|
| + {
|
| + DartImport imprt = assertLocation(
|
| + libraryTest.getDefiningCompilationUnit(),
|
| + "aaa.field",
|
| + DartImport.class,
|
| + "'aaa');",
|
| + 5);
|
| + assertEquals(libraryA, imprt.getLibrary());
|
| + assertEquals("aaa", imprt.getPrefix());
|
| + }
|
| + } finally {
|
| + testProject.dispose();
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * Test for {@link DartImport}.
|
| + */
|
| + public void test_DartImport_onPrefixUsage_inFunctionReference() throws Exception {
|
| + TestProject testProject = new TestProject("Test");
|
| + try {
|
| + IResource libResourceA = testProject.setUnitContent(
|
| + "LibA.dart",
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "#library('libA');",
|
| + "f() {}",
|
| + "")).getResource();
|
| + IResource resourceTest = testProject.setUnitContent(
|
| + "TestC.dart",
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "#library('Test');",
|
| + "#import('LibA.dart', prefix: 'aaa');",
|
| + "f() {",
|
| + " aaa.f();",
|
| + "}",
|
| + "")).getResource();
|
| + TestProject.waitForAutoBuild();
|
| + DartLibrary libraryA = testProject.getDartProject().getDartLibrary(libResourceA);
|
| + DartLibrary libraryTest = testProject.getDartProject().getDartLibrary(resourceTest);
|
| + // usage of "aaa" = "libraryA"
|
| + {
|
| + DartImport imprt = assertLocation(
|
| + libraryTest.getDefiningCompilationUnit(),
|
| + "aaa.f();",
|
| + DartImport.class,
|
| + "'aaa');",
|
| + 5);
|
| + assertEquals(libraryA, imprt.getLibrary());
|
| + assertEquals("aaa", imprt.getPrefix());
|
| + }
|
| + } finally {
|
| + testProject.dispose();
|
| + }
|
| + }
|
| +
|
| public void test_DartImport_onURI() throws Exception {
|
| TestProject testProject = new TestProject("Test");
|
| try {
|
|
|