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

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

Issue 685573002: Inline JUnitTestCase 'assert' methods. (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/java_junit.dart';
8 import 'package:analyzer/src/generated/source_io.dart'; 7 import 'package:analyzer/src/generated/source_io.dart';
9 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
11 import 'package:unittest/unittest.dart' as _ut; 10 import 'package:unittest/unittest.dart';
12 import 'resolver_test.dart'; 11 import 'resolver_test.dart';
13 import 'test_support.dart'; 12 import 'test_support.dart';
14 import '../reflective_tests.dart'; 13 import '../reflective_tests.dart';
15 14
16 15
17 class StaticWarningCodeTest extends ResolverTestCase { 16 class StaticWarningCodeTest extends ResolverTestCase {
18 void fail_undefinedGetter() { 17 void fail_undefinedGetter() {
19 Source source = addSource(r''' 18 Source source = addSource(r'''
20 '''); 19 ''');
21 resolve(source); 20 resolve(source);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 library lib2; 266 library lib2;
268 class _A {} 267 class _A {}
269 g(h(_A a)) {}'''); 268 g(h(_A a)) {}''');
270 resolve(source); 269 resolve(source);
271 // 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.
272 // Furthermore, the error message should mention both _A and the filenames 271 // Furthermore, the error message should mention both _A and the filenames
273 // so the user can figure out what's going on. 272 // so the user can figure out what's going on.
274 List<AnalysisError> errors = analysisContext2.computeErrors(source); 273 List<AnalysisError> errors = analysisContext2.computeErrors(source);
275 EngineTestCase.assertLength(1, errors); 274 EngineTestCase.assertLength(1, errors);
276 AnalysisError error = errors[0]; 275 AnalysisError error = errors[0];
277 JUnitTestCase.assertEquals(error.errorCode, StaticWarningCode.ARGUMENT_TYPE_ NOT_ASSIGNABLE); 276 expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode);
278 String message = error.message; 277 String message = error.message;
279 JUnitTestCase.assertTrue(message.indexOf("_A") != -1); 278 expect(message.indexOf("_A") != -1, isTrue);
280 JUnitTestCase.assertTrue(message.indexOf("lib1.dart") != -1); 279 expect(message.indexOf("lib1.dart") != -1, isTrue);
281 JUnitTestCase.assertTrue(message.indexOf("lib2.dart") != -1); 280 expect(message.indexOf("lib2.dart") != -1, isTrue);
282 } 281 }
283 282
284 void test_argumentTypeNotAssignable_annotation_namedConstructor() { 283 void test_argumentTypeNotAssignable_annotation_namedConstructor() {
285 Source source = addSource(r''' 284 Source source = addSource(r'''
286 class A { 285 class A {
287 const A.fromInt(int p); 286 const A.fromInt(int p);
288 } 287 }
289 @A.fromInt('0') 288 @A.fromInt('0')
290 main() { 289 main() {
291 }'''); 290 }''');
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 Source source = addSource(r''' 3135 Source source = addSource(r'''
3137 class S { 3136 class S {
3138 void get value {} 3137 void get value {}
3139 }'''); 3138 }''');
3140 resolve(source); 3139 resolve(source);
3141 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); 3140 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
3142 } 3141 }
3143 } 3142 }
3144 3143
3145 main() { 3144 main() {
3146 _ut.groupSep = ' | '; 3145 groupSep = ' | ';
3147 runReflectiveTests(StaticWarningCodeTest); 3146 runReflectiveTests(StaticWarningCodeTest);
3148 } 3147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698