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

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

Issue 1174763002: Use ConstantVerifier in VerifyUnitTask. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/dart.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 library test.src.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 2620
2621 void _performScanTask(String content) { 2621 void _performScanTask(String content) {
2622 AnalysisTarget target = newSource('/test.dart', content); 2622 AnalysisTarget target = newSource('/test.dart', content);
2623 _computeResult(target, TOKEN_STREAM); 2623 _computeResult(target, TOKEN_STREAM);
2624 expect(task, new isInstanceOf<ScanDartTask>()); 2624 expect(task, new isInstanceOf<ScanDartTask>());
2625 } 2625 }
2626 } 2626 }
2627 2627
2628 @reflectiveTest 2628 @reflectiveTest
2629 class VerifyUnitTaskTest extends _AbstractDartTaskTest { 2629 class VerifyUnitTaskTest extends _AbstractDartTaskTest {
2630 test_perform_constantError() {
2631 Source source = newSource('/test.dart', '''
2632 main(int p) {
2633 const v = p;
2634 }
2635 ''');
2636 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
2637 _computeResult(target, VERIFY_ERRORS);
2638 expect(task, new isInstanceOf<VerifyUnitTask>());
2639 // validate
2640 _fillErrorListener(VERIFY_ERRORS);
2641 errorListener.assertErrorsWithCodes(<ErrorCode>[
2642 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
2643 ]);
2644 }
2645
2630 test_perform_directiveError() { 2646 test_perform_directiveError() {
2631 Source source = newSource('/test.dart', ''' 2647 Source source = newSource('/test.dart', '''
2632 import 'no-such-file.dart'; 2648 import 'no-such-file.dart';
2633 '''); 2649 ''');
2634 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); 2650 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
2635 _computeResult(target, VERIFY_ERRORS); 2651 _computeResult(target, VERIFY_ERRORS);
2636 expect(task, new isInstanceOf<VerifyUnitTask>()); 2652 expect(task, new isInstanceOf<VerifyUnitTask>());
2637 // validate 2653 // validate
2638 _fillErrorListener(VERIFY_ERRORS); 2654 _fillErrorListener(VERIFY_ERRORS);
2639 errorListener.assertErrorsWithCodes( 2655 errorListener.assertErrorsWithCodes(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 /** 2716 /**
2701 * Fill [errorListener] with [result] errors in the current [task]. 2717 * Fill [errorListener] with [result] errors in the current [task].
2702 */ 2718 */
2703 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 2719 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
2704 List<AnalysisError> errors = task.outputs[result]; 2720 List<AnalysisError> errors = task.outputs[result];
2705 expect(errors, isNotNull, reason: result.name); 2721 expect(errors, isNotNull, reason: result.name);
2706 errorListener = new GatheringErrorListener(); 2722 errorListener = new GatheringErrorListener();
2707 errorListener.addAll(errors); 2723 errorListener.addAll(errors);
2708 } 2724 }
2709 } 2725 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698