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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1193143002: Next steps toward HTML support (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 6 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 | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/test/src/task/html_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 81119c63ad80801b296dc9177fb6cd44aca2d50b..2f8fdf6b13d5159d9c0047a61e49a7bf62b56b89 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -12,9 +12,11 @@ import 'package:analyzer/src/generated/engine.dart'
show AnalysisOptionsImpl, CacheState;
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/scanner.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/task/dart.dart';
+import 'package:analyzer/src/task/html.dart';
import 'package:analyzer/task/dart.dart';
import 'package:analyzer/task/general.dart';
import 'package:analyzer/task/model.dart';
@@ -2207,7 +2209,6 @@ class ParseDartTaskTest extends _AbstractDartTaskTest {
expect(inputs, isNotNull);
expect(inputs.keys, unorderedEquals([
ParseDartTask.LINE_INFO_INPUT_NAME,
- ParseDartTask.MODIFICATION_TIME_INPUT_NAME,
ParseDartTask.TOKEN_STREAM_INPUT_NAME
]));
}
@@ -2276,7 +2277,7 @@ part 'test.dart';
expect(outputs[INCLUDED_PARTS], hasLength(0));
expect(outputs[PARSE_ERRORS], hasLength(0));
expect(outputs[PARSED_UNIT], isNotNull);
- expect(outputs[SOURCE_KIND], SourceKind.UNKNOWN);
+ expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
expect(outputs[UNITS], hasLength(1));
}
@@ -2665,6 +2666,33 @@ class ScanDartTaskTest extends _AbstractDartTaskTest {
expect(outputs[TOKEN_STREAM], isNotNull);
}
+ test_perform_script() {
+ String scriptContent = '''
+ void buttonPressed() {
+ ''';
+ String htmlContent = '''
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>test page</title>
+ <script type='application/dart'>$scriptContent</script>
+ </head>
+ <body>Test</body>
+</html>
+''';
+ Source source = newSource('/test.html', htmlContent);
+ DartScript script =
+ new DartScript(source, [new ScriptFragment(97, 5, 36, scriptContent)]);
+
+ computeResult(script, TOKEN_STREAM);
+ expect(task, new isInstanceOf<ScanDartTask>());
+ expect(outputs[LINE_INFO], isNotNull);
+ expect(outputs[SCAN_ERRORS], isEmpty);
+ Token tokenStream = outputs[TOKEN_STREAM];
+ expect(tokenStream, isNotNull);
+ expect(tokenStream.lexeme, 'void');
+ }
+
void _performScanTask(String content) {
AnalysisTarget target = newSource('/test.dart', content);
computeResult(target, TOKEN_STREAM);
@@ -2744,6 +2772,26 @@ class _AbstractDartTaskTest extends AbstractContextTest {
});
}
+ /**
+ * Create a script object with a single fragment containing the given
+ * [scriptContent].
+ */
+ DartScript createScript(String scriptContent) {
+ String htmlContent = '''
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>test page</title>
+ <script type='application/dart'>$scriptContent</script>
+ </head>
+ <body>Test</body>
+</html>
+''';
+ Source source = newSource('/test.html', htmlContent);
+ return new DartScript(
+ source, [new ScriptFragment(97, 5, 36, scriptContent)]);
+ }
+
void setUp() {
super.setUp();
emptySource = newSource('/test.dart');
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/test/src/task/html_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698