Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1831)

Unified Diff: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java

Issue 223323002: Version 1.3.0-dev.7.10 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java (revision 34682)
+++ dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java (working copy)
@@ -15,6 +15,7 @@
import com.google.dart.engine.EngineTestCase;
import com.google.dart.engine.ast.CompilationUnit;
+import com.google.dart.engine.ast.ImportDirective;
import com.google.dart.engine.ast.SimpleIdentifier;
import com.google.dart.engine.ast.TopLevelVariableDeclaration;
import com.google.dart.engine.context.AnalysisContextFactory;
@@ -30,7 +31,9 @@
import com.google.dart.engine.element.LibraryElement;
import com.google.dart.engine.element.PropertyAccessorElement;
import com.google.dart.engine.error.AnalysisError;
+import com.google.dart.engine.html.ast.HtmlScriptTagNode;
import com.google.dart.engine.html.ast.HtmlUnit;
+import com.google.dart.engine.html.ast.XmlTagNode;
import com.google.dart.engine.internal.cache.DartEntry;
import com.google.dart.engine.internal.scope.Namespace;
import com.google.dart.engine.internal.task.ResolveDartLibraryTask;
@@ -869,6 +872,32 @@
assertNotNull(unit);
}
+ public void test_parseHtmlUnit_resolveDirectives() throws Exception {
+ Source libSource = addSource("/lib.dart", createSource(//
+ "library lib;",
+ "class ClassA {}"));
+ Source source = addSource("/lib.html", createSource(//
+ "<html>",
+ "<head>",
+ " <script type='application/dart'>",
+ " import 'lib.dart';",
+ " ClassA v = null;",
+ " </script>",
+ "</head>",
+ "<body>",
+ "</body>",
+ "</html>"));
+ HtmlUnit unit = context.parseHtmlUnit(source);
+ // import directive should be resolved
+ XmlTagNode htmlNode = unit.getTagNodes().get(0);
+ XmlTagNode headNode = htmlNode.getTagNodes().get(0);
+ HtmlScriptTagNode scriptNode = (HtmlScriptTagNode) headNode.getTagNodes().get(0);
+ CompilationUnit script = scriptNode.getScript();
+ ImportDirective importNode = (ImportDirective) script.getDirectives().get(0);
+ assertNotNull(importNode.getUriContent());
+ assertEquals(libSource, importNode.getSource());
+ }
+
public void test_performAnalysisTask_changeLibraryContents() throws Exception {
Source libSource = addSource("/test.dart", "library lib; part 'test-part.dart';");
Source partSource = addSource("/test-part.dart", "part of lib;");

Powered by Google App Engine
This is Rietveld 408576698