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

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

Issue 2656783002: Fix tests to run with the new analysis driver. (Closed)
Patch Set: Created 3 years, 11 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
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 analyzer.test.generated.static_warning_code_test; 5 library analyzer.test.generated.static_warning_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/source_io.dart'; 10 import 'package:analyzer/src/generated/source_io.dart';
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 }'''); 367 }''');
368 addNamedSource( 368 addNamedSource(
369 "/lib2.dart", 369 "/lib2.dart",
370 r''' 370 r'''
371 library lib2; 371 library lib2;
372 class _A {} 372 class _A {}
373 g(h(_A a)) {}'''); 373 g(h(_A a)) {}''');
374 // The name _A is private to the library it's defined in, so this is a type 374 // The name _A is private to the library it's defined in, so this is a type
375 // mismatch. Furthermore, the error message should mention both _A and the 375 // mismatch. Furthermore, the error message should mention both _A and the
376 // filenames so the user can figure out what's going on. 376 // filenames so the user can figure out what's going on.
377 List<AnalysisError> errors = analysisContext2.computeErrors(source); 377 TestAnalysisResult analysisResult = await computeAnalysisResult(source);
378 List<AnalysisError> errors = analysisResult.errors;
378 expect(errors, hasLength(1)); 379 expect(errors, hasLength(1));
379 AnalysisError error = errors[0]; 380 AnalysisError error = errors[0];
380 expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode); 381 expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode);
381 String message = error.message; 382 String message = error.message;
382 expect(message.indexOf("_A") != -1, isTrue); 383 expect(message.indexOf("_A") != -1, isTrue);
383 expect(message.indexOf("lib1.dart") != -1, isTrue); 384 expect(message.indexOf("lib1.dart") != -1, isTrue);
384 expect(message.indexOf("lib2.dart") != -1, isTrue); 385 expect(message.indexOf("lib2.dart") != -1, isTrue);
385 } 386 }
386 387
387 test_argumentTypeNotAssignable_annotation_namedConstructor() async { 388 test_argumentTypeNotAssignable_annotation_namedConstructor() async {
(...skipping 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 3707
3707 test_voidReturnForGetter() async { 3708 test_voidReturnForGetter() async {
3708 Source source = addSource(r''' 3709 Source source = addSource(r'''
3709 class S { 3710 class S {
3710 void get value {} 3711 void get value {}
3711 }'''); 3712 }''');
3712 await computeAnalysisResult(source); 3713 await computeAnalysisResult(source);
3713 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); 3714 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
3714 } 3715 }
3715 } 3716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698