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

Unified Diff: pkg/analyzer/test/src/task/strong/strong_test_helper.dart

Issue 1843473002: Sort analyzer sources (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove generated file and fix misplaced comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/src/task/options_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/strong_test_helper.dart
diff --git a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
index e91033eb5cd6bea48a3654df2d7fbba6fe00a12f..f17517d5b752328aff1e00b7fb0956d83d22b28c 100644
--- a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
+++ b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
@@ -113,6 +113,28 @@ CompilationUnit checkFile(String content) {
return check();
}
+void initStrongModeTests() {
+ setUp(() {
+ AnalysisEngine.instance.processRequiredPlugins();
+ files = new MemoryResourceProvider();
+ _checkCalled = false;
+ });
+
+ tearDown(() {
+ // This is a sanity check, in case only addFile is called.
+ expect(_checkCalled, true, reason: 'must call check() method in test case');
+ files = null;
+ });
+}
+
+Level _actualErrorLevel(AnalysisError actual) {
+ return const <ErrorSeverity, Level>{
+ ErrorSeverity.ERROR: Level.SEVERE,
+ ErrorSeverity.WARNING: Level.WARNING,
+ ErrorSeverity.INFO: Level.INFO
+ }[actual.errorCode.errorSeverity];
+}
+
SourceSpanWithContext _createSpanHelper(
LineInfo lineInfo, int start, Source source, String content,
{int end}) {
@@ -149,49 +171,6 @@ String _errorCodeName(ErrorCode errorCode) {
}
}
-void initStrongModeTests() {
- setUp(() {
- AnalysisEngine.instance.processRequiredPlugins();
- files = new MemoryResourceProvider();
- _checkCalled = false;
- });
-
- tearDown(() {
- // This is a sanity check, in case only addFile is called.
- expect(_checkCalled, true, reason: 'must call check() method in test case');
- files = null;
- });
-}
-
-SourceLocation _locationForOffset(LineInfo lineInfo, Uri uri, int offset) {
- var loc = lineInfo.getLocation(offset);
- return new SourceLocation(offset,
- sourceUrl: uri, line: loc.lineNumber - 1, column: loc.columnNumber - 1);
-}
-
-/// Returns all libraries transitively imported or exported from [start].
-List<LibraryElement> _reachableLibraries(LibraryElement start) {
- var results = <LibraryElement>[];
- var seen = new Set();
- void find(LibraryElement lib) {
- if (seen.contains(lib)) return;
- seen.add(lib);
- results.add(lib);
- lib.importedLibraries.forEach(find);
- lib.exportedLibraries.forEach(find);
- }
- find(start);
- return results;
-}
-
-Level _actualErrorLevel(AnalysisError actual) {
- return const <ErrorSeverity, Level>{
- ErrorSeverity.ERROR: Level.SEVERE,
- ErrorSeverity.WARNING: Level.WARNING,
- ErrorSeverity.INFO: Level.INFO
- }[actual.errorCode.errorSeverity];
-}
-
void _expectErrors(CompilationUnit unit, List<AnalysisError> actualErrors) {
var expectedErrors = _findExpectedErrors(unit.beginToken);
@@ -267,6 +246,27 @@ List<_ErrorExpectation> _findExpectedErrors(Token beginToken) {
return expectedErrors;
}
+SourceLocation _locationForOffset(LineInfo lineInfo, Uri uri, int offset) {
+ var loc = lineInfo.getLocation(offset);
+ return new SourceLocation(offset,
+ sourceUrl: uri, line: loc.lineNumber - 1, column: loc.columnNumber - 1);
+}
+
+/// Returns all libraries transitively imported or exported from [start].
+List<LibraryElement> _reachableLibraries(LibraryElement start) {
+ var results = <LibraryElement>[];
+ var seen = new Set();
+ void find(LibraryElement lib) {
+ if (seen.contains(lib)) return;
+ seen.add(lib);
+ results.add(lib);
+ lib.importedLibraries.forEach(find);
+ lib.exportedLibraries.forEach(find);
+ }
+ find(start);
+ return results;
+}
+
void _reportFailure(
CompilationUnit unit,
List<_ErrorExpectation> unreported,
« no previous file with comments | « pkg/analyzer/test/src/task/options_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698