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

Unified Diff: test/testing.dart

Issue 1273343002: fix testChecker to include test inside (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 4 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 | « test/checker/inferred_type_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/testing.dart
diff --git a/test/testing.dart b/test/testing.dart
index 71c22fc4f9539ca5a3cf60e9d55547df06d44962..818cd037e9831109a9427c03b6193471dded3c79 100644
--- a/test/testing.dart
+++ b/test/testing.dart
@@ -72,7 +72,7 @@ class _TestUtils {}
/// '''
/// });
///
-void testChecker(Map<String, String> testFiles,
+void testChecker(String name, Map<String, String> testFiles,
{String sdkDir,
customUrlMappings: const {},
relaxedCasts: true,
@@ -80,44 +80,47 @@ void testChecker(Map<String, String> testFiles,
inferFromOverrides: StrongModeOptions.inferFromOverridesDefault,
inferTransitively: StrongModeOptions.inferTransitivelyDefault,
nonnullableTypes: StrongModeOptions.NONNULLABLE_TYPES}) {
- expect(testFiles.containsKey('/main.dart'), isTrue,
- reason: '`/main.dart` is missing in testFiles');
-
- var provider = createTestResourceProvider(testFiles);
- var uriResolver = new TestUriResolver(provider);
- var context = AnalysisEngine.instance.createAnalysisContext();
- context.sourceFactory = createSourceFactory(
- new SourceResolverOptions(
- customUrlMappings: customUrlMappings,
- useMockSdk: sdkDir == null,
- dartSdkPath: sdkDir),
- fileResolvers: [uriResolver]);
-
- var checker = new StrongChecker(
- context,
- new StrongModeOptions(
- relaxedCasts: relaxedCasts,
- inferDownwards: inferDownwards,
- inferFromOverrides: inferFromOverrides,
- inferTransitively: inferTransitively,
- nonnullableTypes: nonnullableTypes,
- hints: true));
-
- // Run the checker on /main.dart.
- var mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart'));
- var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource);
-
- // Extract expectations from the comments in the test files, and
- // check that all errors we emit are included in the expected map.
- var allLibraries = reachableLibraries(initialLibrary.element.library);
- for (var lib in allLibraries) {
- for (var unit in lib.units) {
- if (unit.source.uri.scheme == 'dart') continue;
-
- var errorInfo = checker.computeErrors(unit.source);
- new _ExpectedErrorVisitor(errorInfo.errors).validate(unit.unit);
+ test(name, () {
+ expect(testFiles.containsKey('/main.dart'), isTrue,
+ reason: '`/main.dart` is missing in testFiles');
+
+ var provider = createTestResourceProvider(testFiles);
+ var uriResolver = new TestUriResolver(provider);
+ var context = AnalysisEngine.instance.createAnalysisContext();
+ context.sourceFactory = createSourceFactory(
+ new SourceResolverOptions(
+ customUrlMappings: customUrlMappings,
+ useMockSdk: sdkDir == null,
+ dartSdkPath: sdkDir),
+ fileResolvers: [uriResolver]);
+
+ var checker = new StrongChecker(
+ context,
+ new StrongModeOptions(
+ relaxedCasts: relaxedCasts,
+ inferDownwards: inferDownwards,
+ inferFromOverrides: inferFromOverrides,
+ inferTransitively: inferTransitively,
+ nonnullableTypes: nonnullableTypes,
+ hints: true));
+
+ // Run the checker on /main.dart.
+ var mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart'));
+ var initialLibrary =
+ context.resolveCompilationUnit2(mainSource, mainSource);
+
+ // Extract expectations from the comments in the test files, and
+ // check that all errors we emit are included in the expected map.
+ var allLibraries = reachableLibraries(initialLibrary.element.library);
+ for (var lib in allLibraries) {
+ for (var unit in lib.units) {
+ if (unit.source.uri.scheme == 'dart') continue;
+
+ var errorInfo = checker.computeErrors(unit.source);
+ new _ExpectedErrorVisitor(errorInfo.errors).validate(unit.unit);
+ }
}
- }
+ });
}
/// Creates a [MemoryResourceProvider] with test data
« no previous file with comments | « test/checker/inferred_type_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698