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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1418663002: Issue 24552. Disable reporting HTML parsing errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/html.dart ('k') | pkg/analyzer/test/src/task/html_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.context.context_test; 5 library test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 import 'abstract_context.dart'; 49 import 'abstract_context.dart';
50 50
51 main() { 51 main() {
52 initializeTestEnvironment(); 52 initializeTestEnvironment();
53 runReflectiveTests(AnalysisContextImplTest); 53 runReflectiveTests(AnalysisContextImplTest);
54 runReflectiveTests(LimitedInvalidateTest); 54 runReflectiveTests(LimitedInvalidateTest);
55 } 55 }
56 56
57 @reflectiveTest 57 @reflectiveTest
58 class AnalysisContextImplTest extends AbstractContextTest { 58 class AnalysisContextImplTest extends AbstractContextTest {
59 void fail_getErrors_html_some() {
60 Source source = addSource(
61 "/test.html",
62 r'''
63 <html><head>
64 <script type='application/dart' src='test.dart'/>
65 </head></html>''');
66 AnalysisErrorInfo errorInfo = context.getErrors(source);
67 expect(errorInfo, isNotNull);
68 List<AnalysisError> errors = errorInfo.errors;
69 expect(errors, hasLength(0));
70 errors = context.computeErrors(source);
71 expect(errors, hasLength(2));
72 }
73
59 Future fail_implicitAnalysisEvents_removed() async { 74 Future fail_implicitAnalysisEvents_removed() async {
60 AnalyzedSourcesListener listener = new AnalyzedSourcesListener(); 75 AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
61 context.implicitAnalysisEvents.listen(listener.onData); 76 context.implicitAnalysisEvents.listen(listener.onData);
62 // 77 //
63 // Create a file that references an file that is not explicitly being 78 // Create a file that references an file that is not explicitly being
64 // analyzed and fully analyze it. Ensure that the listener is told about 79 // analyzed and fully analyze it. Ensure that the listener is told about
65 // the implicitly analyzed file. 80 // the implicitly analyzed file.
66 // 81 //
67 Source sourceA = newSource('/a.dart', "library a; import 'b.dart';"); 82 Source sourceA = newSource('/a.dart', "library a; import 'b.dart';");
68 Source sourceB = newSource('/b.dart', "library b;"); 83 Source sourceB = newSource('/b.dart', "library b;");
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 Source source = addSource("/test.html", "<html></html>"); 910 Source source = addSource("/test.html", "<html></html>");
896 AnalysisErrorInfo errorInfo = context.getErrors(source); 911 AnalysisErrorInfo errorInfo = context.getErrors(source);
897 expect(errorInfo, isNotNull); 912 expect(errorInfo, isNotNull);
898 List<AnalysisError> errors = errorInfo.errors; 913 List<AnalysisError> errors = errorInfo.errors;
899 expect(errors, hasLength(0)); 914 expect(errors, hasLength(0));
900 context.computeErrors(source); 915 context.computeErrors(source);
901 errors = errorInfo.errors; 916 errors = errorInfo.errors;
902 expect(errors, hasLength(0)); 917 expect(errors, hasLength(0));
903 } 918 }
904 919
905 void test_getErrors_html_some() {
906 Source source = addSource(
907 "/test.html",
908 r'''
909 <html><head>
910 <script type='application/dart' src='test.dart'/>
911 </head></html>''');
912 AnalysisErrorInfo errorInfo = context.getErrors(source);
913 expect(errorInfo, isNotNull);
914 List<AnalysisError> errors = errorInfo.errors;
915 expect(errors, hasLength(0));
916 errors = context.computeErrors(source);
917 expect(errors, hasLength(2));
918 }
919
920 void test_getHtmlFilesReferencing_html() { 920 void test_getHtmlFilesReferencing_html() {
921 Source htmlSource = addSource( 921 Source htmlSource = addSource(
922 "/test.html", 922 "/test.html",
923 r''' 923 r'''
924 <html><head> 924 <html><head>
925 <script type='application/dart' src='test.dart'/> 925 <script type='application/dart' src='test.dart'/>
926 <script type='application/dart' src='test.js'/> 926 <script type='application/dart' src='test.js'/>
927 </head></html>'''); 927 </head></html>''');
928 Source librarySource = addSource("/test.dart", "library lib;"); 928 Source librarySource = addSource("/test.dart", "library lib;");
929 Source secondHtmlSource = addSource("/test.html", "<html></html>"); 929 Source secondHtmlSource = addSource("/test.html", "<html></html>");
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 } 2561 }
2562 } 2562 }
2563 2563
2564 class _AnalysisContextImplTest_test_applyChanges_removeContainer 2564 class _AnalysisContextImplTest_test_applyChanges_removeContainer
2565 implements SourceContainer { 2565 implements SourceContainer {
2566 Source libB; 2566 Source libB;
2567 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); 2567 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB);
2568 @override 2568 @override
2569 bool contains(Source source) => source == libB; 2569 bool contains(Source source) => source == libB;
2570 } 2570 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/html.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