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

Side by Side Diff: pkg/analyzer/test/generated/static_warning_code_test.dart

Issue 686793002: Replace EngineTestCase.assertSize() with hasLength(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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 engine.static_warning_code_test; 5 library engine.static_warning_code_test;
6 6
7 import 'package:analyzer/src/generated/source_io.dart'; 7 import 'package:analyzer/src/generated/source_io.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 }'''); 264 }''');
265 addNamedSource("/lib2.dart", r''' 265 addNamedSource("/lib2.dart", r'''
266 library lib2; 266 library lib2;
267 class _A {} 267 class _A {}
268 g(h(_A a)) {}'''); 268 g(h(_A a)) {}''');
269 resolve(source); 269 resolve(source);
270 // The name _A is private to the library it's defined in, so this is a type mismatch. 270 // The name _A is private to the library it's defined in, so this is a type mismatch.
271 // Furthermore, the error message should mention both _A and the filenames 271 // Furthermore, the error message should mention both _A and the filenames
272 // so the user can figure out what's going on. 272 // so the user can figure out what's going on.
273 List<AnalysisError> errors = analysisContext2.computeErrors(source); 273 List<AnalysisError> errors = analysisContext2.computeErrors(source);
274 EngineTestCase.assertLength(1, errors); 274 expect(errors, hasLength(1));
275 AnalysisError error = errors[0]; 275 AnalysisError error = errors[0];
276 expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode); 276 expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode);
277 String message = error.message; 277 String message = error.message;
278 expect(message.indexOf("_A") != -1, isTrue); 278 expect(message.indexOf("_A") != -1, isTrue);
279 expect(message.indexOf("lib1.dart") != -1, isTrue); 279 expect(message.indexOf("lib1.dart") != -1, isTrue);
280 expect(message.indexOf("lib2.dart") != -1, isTrue); 280 expect(message.indexOf("lib2.dart") != -1, isTrue);
281 } 281 }
282 282
283 void test_argumentTypeNotAssignable_annotation_namedConstructor() { 283 void test_argumentTypeNotAssignable_annotation_namedConstructor() {
284 Source source = addSource(r''' 284 Source source = addSource(r'''
(...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after
3138 }'''); 3138 }''');
3139 resolve(source); 3139 resolve(source);
3140 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); 3140 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
3141 } 3141 }
3142 } 3142 }
3143 3143
3144 main() { 3144 main() {
3145 groupSep = ' | '; 3145 groupSep = ' | ';
3146 runReflectiveTests(StaticWarningCodeTest); 3146 runReflectiveTests(StaticWarningCodeTest);
3147 } 3147 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/analyzer/test/generated/test_support.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698