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

Side by Side Diff: pkg/analyzer/test/src/task/strong/strong_test_helper.dart

Issue 1510653002: add tests to demonstrate missing generic function subtype logic (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/test/src/task/strong/checker_test.dart ('k') | no next file » | 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) 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 // TODO(jmesserly): this file needs to be refactored, it's a port from 5 // TODO(jmesserly): this file needs to be refactored, it's a port from
6 // package:dev_compiler's tests 6 // package:dev_compiler's tests
7 library test.src.task.strong.strong_test_helper; 7 library test.src.task.strong.strong_test_helper;
8 8
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Use error marker found in an immediately preceding comment, 166 // Use error marker found in an immediately preceding comment,
167 // and attach it to the outermost expression that starts at that token. 167 // and attach it to the outermost expression that starts at that token.
168 if (comment != null) { 168 if (comment != null) {
169 while (comment.next != null) { 169 while (comment.next != null) {
170 comment = comment.next; 170 comment = comment.next;
171 } 171 }
172 if (comment.end == token.offset && node.parent.beginToken != token) { 172 if (comment.end == token.offset && node.parent.beginToken != token) {
173 var commentText = '$comment'; 173 var commentText = '$comment';
174 var start = commentText.lastIndexOf('/*'); 174 var start = commentText.lastIndexOf('/*');
175 var end = commentText.lastIndexOf('*/'); 175 var end = commentText.lastIndexOf('*/');
176 if (start != -1 && end != -1) { 176 if (start != -1 &&
177 end != -1 &&
178 !commentText.startsWith('/*<', start) &&
179 !commentText.startsWith('/*=', start)) {
177 expect(start, lessThan(end)); 180 expect(start, lessThan(end));
178 var errors = commentText.substring(start + 2, end).split(','); 181 var errors = commentText.substring(start + 2, end).split(',');
179 var expectations = 182 var expectations =
180 errors.map(_ErrorExpectation.parse).where((x) => x != null); 183 errors.map(_ErrorExpectation.parse).where((x) => x != null);
181 184
182 for (var e in expectations) _expectError(node, e); 185 for (var e in expectations) {
186 _expectError(node, e);
187 }
183 } 188 }
184 } 189 }
185 } 190 }
186 return super.visitNode(node); 191 return super.visitNode(node);
187 } 192 }
188 193
189 void _expectError(AstNode node, _ErrorExpectation expected) { 194 void _expectError(AstNode node, _ErrorExpectation expected) {
190 // See if we can find the expected error in our actual errors 195 // See if we can find the expected error in our actual errors
191 for (var actual in _actualErrors) { 196 for (var actual in _actualErrors) {
192 if (actual.offset == node.offset && actual.length == node.length) { 197 if (actual.offset == node.offset && actual.length == node.length) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 if (levelName == 'warning') return _MAGENTA_COLOR; 509 if (levelName == 'warning') return _MAGENTA_COLOR;
505 if (levelName == 'info') return _CYAN_COLOR; 510 if (levelName == 'info') return _CYAN_COLOR;
506 return null; 511 return null;
507 } 512 }
508 513
509 const String _RED_COLOR = '\u001b[31m'; 514 const String _RED_COLOR = '\u001b[31m';
510 const String _MAGENTA_COLOR = '\u001b[35m'; 515 const String _MAGENTA_COLOR = '\u001b[35m';
511 const String _CYAN_COLOR = '\u001b[36m'; 516 const String _CYAN_COLOR = '\u001b[36m';
512 const String GREEN_COLOR = '\u001b[32m'; 517 const String GREEN_COLOR = '\u001b[32m';
513 const String NO_COLOR = '\u001b[0m'; 518 const String NO_COLOR = '\u001b[0m';
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/strong/checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698