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

Unified Diff: pkg/code_transformers/lib/tests.dart

Issue 203723006: Fixes how to lookup sdk dir to support tests deeper inside test/ folders. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/code_transformers/lib/src/dart_sdk.dart ('k') | pkg/smoke/test/codegen/testing_resolver_utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/code_transformers/lib/tests.dart
diff --git a/pkg/code_transformers/lib/tests.dart b/pkg/code_transformers/lib/tests.dart
index bd6886cadef7f6cbe77a4974bf5755beb3eadbef..9ed8e0bdc342f52db06bb13011e7984af0398256 100644
--- a/pkg/code_transformers/lib/tests.dart
+++ b/pkg/code_transformers/lib/tests.dart
@@ -7,11 +7,14 @@
library code_transformers.tests;
import 'dart:async' show Future;
+import 'dart:io' show Platform;
import 'package:barback/barback.dart' show Transformer;
+import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
import 'src/test_harness.dart';
+import 'src/dart_sdk.dart';
/// Defines a test which invokes [applyTransformers].
testPhases(String testName, List<List<Transformer>> phases,
@@ -38,3 +41,19 @@ Future applyTransformers(List<List<Transformer>> phases,
var helper = new TestHelper(phases, inputs, messages)..run();
return helper.checkAll(results).then((_) => helper.tearDown());
}
+
+/// Variant of [dartSdkDirectory] which includes additional cases only
+/// typically encountered in Dart's testing environment.
+String get testingDartSdkDirectory {
+ var sdkDir = dartSdkDirectory;
+ if (sdkDir == null) {
+ // If we cannot find the SDK dir, then assume this is being run from Dart's
+ // source directory and this script is the main script.
+ var segments = path.split(path.fromUri(Platform.script));
+ var index = segments.indexOf('pkg');
+ expect(index, greaterThan(0),
+ reason: 'testingDartSdkDirectory is only supported in pkg/ tests');
+ sdkDir = path.joinAll(segments.sublist(0, index)..add('sdk'));
+ }
+ return sdkDir;
+}
« no previous file with comments | « pkg/code_transformers/lib/src/dart_sdk.dart ('k') | pkg/smoke/test/codegen/testing_resolver_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698