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

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

Issue 214603014: Trunk CL for r=34540 (Closed) Base URL: https://dart.googlecode.com/svn/trunk/dart
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
« no previous file with comments | « editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/task/ParseHtmlTask.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java
index e9b3439ddaab45abb6e2e260e8604b3604ec0ed4..e8f6355e9c9fff5618bb13b4dedb6368ae03a2d5 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java
@@ -15,6 +15,7 @@ package com.google.dart.engine.internal.context;
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.HtmlElement;
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 @@ public class AnalysisContextImplTest extends EngineTestCase {
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;");
« no previous file with comments | « editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/task/ParseHtmlTask.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698