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

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

Issue 1185443002: Support for parsing HTML in the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
Index: pkg/analyzer/test/src/task/html_test.dart
diff --git a/pkg/analyzer/test/src/task/html_test.dart b/pkg/analyzer/test/src/task/html_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..be49ae5e15297258154b106d8f862a8a8c992da5
--- /dev/null
+++ b/pkg/analyzer/test/src/task/html_test.dart
@@ -0,0 +1,83 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.src.task.html_test;
+
+import 'package:analyzer/src/context/cache.dart';
+import 'package:analyzer/src/generated/ast.dart';
+import 'package:analyzer/src/generated/constant.dart';
+import 'package:analyzer/src/generated/element.dart';
+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/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/task/html.dart';
+import 'package:analyzer/task/dart.dart';
+import 'package:analyzer/task/general.dart';
+import 'package:analyzer/task/html.dart';
+import 'package:analyzer/task/model.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../generated/test_support.dart';
+import '../../reflective_tests.dart';
+import '../context/abstract_context.dart';
+
+main() {
+ groupSep = ' | ';
+ runReflectiveTests(ParseHtmlTaskTest);
+}
+
+@reflectiveTest
+class ParseHtmlTaskTest extends AbstractContextTest {
+ test_buildInputs() {
+ Source source = newSource('/test.html');
+ Map<String, TaskInput> inputs = ParseHtmlTask.buildInputs(source);
+ expect(inputs, isNotNull);
+ expect(inputs.keys, unorderedEquals([ParseHtmlTask.CONTENT_INPUT_NAME]));
+ }
+
+ test_constructor() {
+ Source source = newSource('/test.html');
+ ParseHtmlTask task = new ParseHtmlTask(context, source);
+ expect(task, isNotNull);
+ expect(task.context, context);
+ expect(task.target, source);
+ }
+
+ test_createTask() {
+ Source source = newSource('/test.html');
+ ParseHtmlTask task = ParseHtmlTask.createTask(context, source);
+ expect(task, isNotNull);
+ expect(task.context, context);
+ expect(task.target, source);
+ }
+
+ test_description() {
+ Source source = newSource('/test.html');
+ ParseHtmlTask task = new ParseHtmlTask(null, source);
+ expect(task.description, isNotNull);
+ }
+
+ test_descriptor() {
+ TaskDescriptor descriptor = ParseHtmlTask.DESCRIPTOR;
+ expect(descriptor, isNotNull);
+ }
+
+ test_perform() {
+ AnalysisTarget target = newSource('/test.html', r'''
+<html>
+ <head>
+ <title 'test page'/>
+ </head>
+ <body>
+ Test
+ </body>
+</html>
+''');
+ computeResult(target, DOCUMENT);
scheglov 2015/06/11 20:17:30 Would be nice to have a test for not empty DOCUMEN
Brian Wilkerson 2015/06/11 20:23:29 Done
+ expect(task, new isInstanceOf<ParseHtmlTask>());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698