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

Unified Diff: tests/standalone/io/process_environment_test.dart

Issue 17261026: Include parent environment by default, add option to not, for Process. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « sdk/lib/io/process.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/process_environment_test.dart
diff --git a/tests/standalone/io/process_environment_test.dart b/tests/standalone/io/process_environment_test.dart
index 24cc73d326576fe4dfee0d53038029952dafe6bf..5291751988a2fc3bff39cf689e85b0d6114c9774 100644
--- a/tests/standalone/io/process_environment_test.dart
+++ b/tests/standalone/io/process_environment_test.dart
@@ -7,7 +7,7 @@ import "dart:io";
import "dart:isolate";
import "process_test_util.dart";
-runEnvironmentProcess(Map environment, name, callback) {
+runEnvironmentProcess(Map environment, name, includeParent, callback) {
var dartExecutable = new Options().executable;
var printEnv = 'tests/standalone/io/print_env.dart';
if (!new File(printEnv).existsSync()) {
@@ -15,7 +15,8 @@ runEnvironmentProcess(Map environment, name, callback) {
}
Process.run(dartExecutable,
[printEnv, name],
- environment: environment)
+ environment: environment,
+ includeParentEnvironment: includeParent)
.then((result) {
Expect.equals(0, result.exitCode);
callback(result.stdout);
@@ -29,7 +30,7 @@ testEnvironment() {
// Check that some value in the environment stays the same when passed
// to another process.
for (var k in env.keys) {
- runEnvironmentProcess(env, k, (output) {
+ runEnvironmentProcess({}, k, true, (output) {
// Only check startsWith. The print statements will add
// newlines at the end.
Expect.isTrue(output.startsWith(env[k]));
@@ -39,7 +40,7 @@ testEnvironment() {
var name = 'MYENVVAR';
while (env.containsKey(name)) name = '${name}_';
copy[name] = 'value';
- runEnvironmentProcess(copy, name, (output) {
+ runEnvironmentProcess(copy, name, true, (output) {
Expect.isTrue(output.startsWith('value'));
donePort.close();
});
@@ -50,6 +51,15 @@ testEnvironment() {
}
}
+testNoIncludeEnvironment() {
+ var donePort = new ReceivePort();
+ runEnvironmentProcess({}, "PATH", false, (output) {
+ donePort.close();
+ Expect.isTrue(output.startsWith("null"));
+ });
+}
+
main() {
testEnvironment();
+ testNoIncludeEnvironment();
}
« no previous file with comments | « sdk/lib/io/process.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698