OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test.src.task.html_test; | 5 library test.src.task.html_test; |
6 | 6 |
7 import 'package:analyzer/src/context/cache.dart'; | |
8 import 'package:analyzer/src/generated/ast.dart'; | |
9 import 'package:analyzer/src/generated/constant.dart'; | |
10 import 'package:analyzer/src/generated/element.dart'; | |
11 import 'package:analyzer/src/generated/engine.dart' | |
12 show AnalysisOptionsImpl, CacheState; | |
13 import 'package:analyzer/src/generated/error.dart'; | |
14 import 'package:analyzer/src/generated/resolver.dart'; | |
15 import 'package:analyzer/src/generated/sdk.dart'; | |
16 import 'package:analyzer/src/generated/source.dart'; | 7 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:analyzer/src/task/html.dart'; | 8 import 'package:analyzer/src/task/html.dart'; |
18 import 'package:analyzer/task/dart.dart'; | |
19 import 'package:analyzer/task/general.dart'; | |
20 import 'package:analyzer/task/html.dart'; | |
21 import 'package:analyzer/task/model.dart'; | 9 import 'package:analyzer/task/model.dart'; |
22 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
23 | 11 |
24 import '../../generated/test_support.dart'; | |
25 import '../../reflective_tests.dart'; | 12 import '../../reflective_tests.dart'; |
26 import '../context/abstract_context.dart'; | 13 import '../context/abstract_context.dart'; |
27 | 14 |
28 main() { | 15 main() { |
29 groupSep = ' | '; | 16 groupSep = ' | '; |
30 runReflectiveTests(ParseHtmlTaskTest); | 17 runReflectiveTests(ParseHtmlTaskTest); |
31 } | 18 } |
32 | 19 |
33 @reflectiveTest | 20 @reflectiveTest |
34 class ParseHtmlTaskTest extends AbstractContextTest { | 21 class ParseHtmlTaskTest extends AbstractContextTest { |
| 22 fail_perform() { |
| 23 fail('Could not parse the HTML'); |
| 24 // AnalysisTarget target = newSource('/test.html', r''' |
| 25 //<html> |
| 26 // <head> |
| 27 // <title 'test page'/> |
| 28 // </head> |
| 29 // <body> |
| 30 // Test |
| 31 // </body> |
| 32 //</html> |
| 33 //'''); |
| 34 // computeResult(target, DOCUMENT); |
| 35 // expect(task, new isInstanceOf<ParseHtmlTask>()); |
| 36 // expect(outputs[DOCUMENT], isNotNull); |
| 37 // expect(outputs[DOCUMENT_ERRORS], isNotEmpty); |
| 38 } |
| 39 |
35 test_buildInputs() { | 40 test_buildInputs() { |
36 Source source = newSource('/test.html'); | 41 Source source = newSource('/test.html'); |
37 Map<String, TaskInput> inputs = ParseHtmlTask.buildInputs(source); | 42 Map<String, TaskInput> inputs = ParseHtmlTask.buildInputs(source); |
38 expect(inputs, isNotNull); | 43 expect(inputs, isNotNull); |
39 expect(inputs.keys, unorderedEquals([ParseHtmlTask.CONTENT_INPUT_NAME])); | 44 expect(inputs.keys, unorderedEquals([ParseHtmlTask.CONTENT_INPUT_NAME])); |
40 } | 45 } |
41 | 46 |
42 test_constructor() { | 47 test_constructor() { |
43 Source source = newSource('/test.html'); | 48 Source source = newSource('/test.html'); |
44 ParseHtmlTask task = new ParseHtmlTask(context, source); | 49 ParseHtmlTask task = new ParseHtmlTask(context, source); |
(...skipping 13 matching lines...) Expand all Loading... |
58 test_description() { | 63 test_description() { |
59 Source source = newSource('/test.html'); | 64 Source source = newSource('/test.html'); |
60 ParseHtmlTask task = new ParseHtmlTask(null, source); | 65 ParseHtmlTask task = new ParseHtmlTask(null, source); |
61 expect(task.description, isNotNull); | 66 expect(task.description, isNotNull); |
62 } | 67 } |
63 | 68 |
64 test_descriptor() { | 69 test_descriptor() { |
65 TaskDescriptor descriptor = ParseHtmlTask.DESCRIPTOR; | 70 TaskDescriptor descriptor = ParseHtmlTask.DESCRIPTOR; |
66 expect(descriptor, isNotNull); | 71 expect(descriptor, isNotNull); |
67 } | 72 } |
68 | |
69 test_perform() { | |
70 AnalysisTarget target = newSource('/test.html', r''' | |
71 <html> | |
72 <head> | |
73 <title 'test page'/> | |
74 </head> | |
75 <body> | |
76 Test | |
77 </body> | |
78 </html> | |
79 '''); | |
80 computeResult(target, DOCUMENT); | |
81 expect(task, new isInstanceOf<ParseHtmlTask>()); | |
82 expect(outputs[DOCUMENT], isNotNull); | |
83 expect(outputs[DOCUMENT_ERRORS], isNotEmpty); | |
84 } | |
85 } | 73 } |
OLD | NEW |