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

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

Issue 1155693004: Fix NPE in building element model when part URI could not be resolved (Closed) Base URL: https://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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 library lib; 918 library lib;
919 part 'part.dart'; 919 part 'part.dart';
920 ''', 920 ''',
921 '/part.dart': ''' 921 '/part.dart': '''
922 // no part of 922 // no part of
923 ''' 923 '''
924 }); 924 });
925 _assertErrorsWithCodes([CompileTimeErrorCode.PART_OF_NON_PART]); 925 _assertErrorsWithCodes([CompileTimeErrorCode.PART_OF_NON_PART]);
926 } 926 }
927 927
928 test_perform_invalidUri_part() {
929 _performBuildTask({
930 '/lib.dart': '''
931 library lib;
932 part '//////////';
933 '''
934 });
935 expect(libraryElement.parts, isEmpty);
936 }
937
928 test_perform_isLaunchable_inDefiningUnit() { 938 test_perform_isLaunchable_inDefiningUnit() {
929 _performBuildTask({ 939 _performBuildTask({
930 '/lib.dart': ''' 940 '/lib.dart': '''
931 library lib; 941 library lib;
932 main() { 942 main() {
933 } 943 }
934 ''' 944 '''
935 }); 945 });
936 expect(outputs[IS_LAUNCHABLE], isTrue); 946 expect(outputs[IS_LAUNCHABLE], isTrue);
937 expect(libraryElement.entryPoint, isNotNull); 947 expect(libraryElement.entryPoint, isNotNull);
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 /** 2524 /**
2515 * Fill [errorListener] with [result] errors in the current [task]. 2525 * Fill [errorListener] with [result] errors in the current [task].
2516 */ 2526 */
2517 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 2527 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
2518 List<AnalysisError> errors = task.outputs[result]; 2528 List<AnalysisError> errors = task.outputs[result];
2519 expect(errors, isNotNull, reason: result.name); 2529 expect(errors, isNotNull, reason: result.name);
2520 errorListener = new GatheringErrorListener(); 2530 errorListener = new GatheringErrorListener();
2521 errorListener.addAll(errors); 2531 errorListener.addAll(errors);
2522 } 2532 }
2523 } 2533 }
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