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

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

Issue 2745163004: Optionally use Fasta with the new analysis driver. (Closed)
Patch Set: Created 3 years, 9 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/dart/analysis/file_state.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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 { 709 {
710 await scheduler.waitForIdle(); 710 await scheduler.waitForIdle();
711 expect(allResults, hasLength(1)); 711 expect(allResults, hasLength(1));
712 AnalysisResult result = allResults[0]; 712 AnalysisResult result = allResults[0];
713 expect(result.path, testFile); 713 expect(result.path, testFile);
714 expect(_getTopLevelVarType(result.unit, 'V'), 'int'); 714 expect(_getTopLevelVarType(result.unit, 'V'), 'int');
715 } 715 }
716 716
717 // Update the file, but don't notify the driver. 717 // Update the file, but don't notify the driver.
718 allResults.clear(); 718 allResults.clear();
719 provider.updateFile(testFile, 'var V = 1.2'); 719 provider.updateFile(testFile, 'var V = 1.2;');
720 720
721 // No new results. 721 // No new results.
722 await pumpEventQueue(); 722 await pumpEventQueue();
723 expect(allResults, isEmpty); 723 expect(allResults, isEmpty);
724 724
725 // Notify the driver about the change. 725 // Notify the driver about the change.
726 driver.changeFile(testFile); 726 driver.changeFile(testFile);
727 727
728 // The file was added, so it is scheduled for analysis. 728 // The file was added, so it is scheduled for analysis.
729 expect(driver.test.fileTracker.isFilePending(testFile), isTrue); 729 expect(driver.test.fileTracker.isFilePending(testFile), isTrue);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 expect(await driver.getSourceKind(path), SourceKind.PART); 1463 expect(await driver.getSourceKind(path), SourceKind.PART);
1464 } 1464 }
1465 1465
1466 test_getTopLevelNameDeclarations() async { 1466 test_getTopLevelNameDeclarations() async {
1467 var a = _p('/test/lib/a.dart'); 1467 var a = _p('/test/lib/a.dart');
1468 var b = _p('/test/lib/b.dart'); 1468 var b = _p('/test/lib/b.dart');
1469 var c = _p('/test/lib/c.dart'); 1469 var c = _p('/test/lib/c.dart');
1470 var d = _p('/test/lib/d.dart'); 1470 var d = _p('/test/lib/d.dart');
1471 1471
1472 provider.newFile(a, 'class A {}'); 1472 provider.newFile(a, 'class A {}');
1473 provider.newFile(b, 'export "a.dart", class B {}'); 1473 provider.newFile(b, 'export "a.dart"; class B {}');
1474 provider.newFile(c, 'import "d.dart"; class C {}'); 1474 provider.newFile(c, 'import "d.dart"; class C {}');
1475 provider.newFile(d, 'class D {}'); 1475 provider.newFile(d, 'class D {}');
1476 1476
1477 driver.addFile(a); 1477 driver.addFile(a);
1478 driver.addFile(b); 1478 driver.addFile(b);
1479 driver.addFile(c); 1479 driver.addFile(c);
1480 // Don't add d.dart, it is referenced implicitly. 1480 // Don't add d.dart, it is referenced implicitly.
1481 1481
1482 _assertTopLevelDeclarations( 1482 _assertTopLevelDeclarations(
1483 await driver.getTopLevelNameDeclarations('A'), [a, b], [false, true]); 1483 await driver.getTopLevelNameDeclarations('A'), [a, b], [false, true]);
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 * Return the [provider] specific path for the given Posix [path]. 2375 * Return the [provider] specific path for the given Posix [path].
2376 */ 2376 */
2377 String _p(String path) => provider.convertPath(path); 2377 String _p(String path) => provider.convertPath(path);
2378 2378
2379 static String _md5(String content) { 2379 static String _md5(String content) {
2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 2380 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
2381 } 2381 }
2382 } 2382 }
2383 2383
2384 class _SourceMock extends TypedMock implements Source {} 2384 class _SourceMock extends TypedMock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/file_state.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698