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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2495403003: getResult() should not try to compute for non-Dart files. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.driver; 5 library analyzer.test.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // successfully imports file:///my_pkg/test/d.dart, causing y to have an 595 // successfully imports file:///my_pkg/test/d.dart, causing y to have an
596 // inferred type of String. 596 // inferred type of String.
597 { 597 {
598 AnalysisResult result = await driver.getResult(b); 598 AnalysisResult result = await driver.getResult(b);
599 List<AnalysisError> errors = result.errors; 599 List<AnalysisError> errors = result.errors;
600 expect(errors, hasLength(1)); 600 expect(errors, hasLength(1));
601 expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT); 601 expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT);
602 } 602 }
603 } 603 }
604 604
605 test_getResult_notDartFile() async {
606 var path = _p('/test/lib/test.txt');
607 provider.newFile(path, 'foo bar');
608
609 AnalysisResult result = await driver.getResult(path);
610 expect(result, isNull);
611 }
612
605 test_getResult_sameFile_twoUris() async { 613 test_getResult_sameFile_twoUris() async {
606 var a = _p('/test/lib/a.dart'); 614 var a = _p('/test/lib/a.dart');
607 var b = _p('/test/lib/b.dart'); 615 var b = _p('/test/lib/b.dart');
608 var c = _p('/test/test/c.dart'); 616 var c = _p('/test/test/c.dart');
609 provider.newFile(a, 'class A<T> {}'); 617 provider.newFile(a, 'class A<T> {}');
610 provider.newFile( 618 provider.newFile(
611 b, 619 b,
612 r''' 620 r'''
613 import 'a.dart'; 621 import 'a.dart';
614 var VB = new A<int>(); 622 var VB = new A<int>();
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 await _completer.future; 1241 await _completer.future;
1234 _completer = new Completer<Null>(); 1242 _completer = new Completer<Null>();
1235 } 1243 }
1236 1244
1237 void notify() { 1245 void notify() {
1238 if (!_completer.isCompleted) { 1246 if (!_completer.isCompleted) {
1239 _completer.complete(null); 1247 _completer.complete(null);
1240 } 1248 }
1241 } 1249 }
1242 } 1250 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698