| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Process test program to test process communication. | 5 // Process test program to test process communication. |
| 6 | 6 |
| 7 library PlatformExecutableTest; | 7 library PlatformExecutableTest; |
| 8 | 8 |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } finally { | 121 } finally { |
| 122 tempDir.deleteSync(recursive: true); | 122 tempDir.deleteSync(recursive: true); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 String get platformExeName { | 126 String get platformExeName { |
| 127 var raw = new Uri.file(Platform.executable); | 127 var raw = new Uri.file(Platform.executable); |
| 128 return raw.pathSegments.last; | 128 return raw.pathSegments.last; |
| 129 } | 129 } |
| 130 | 130 |
| 131 String get scriptPath => Platform.script.toString(); | 131 String get scriptPath => Platform.script.toFilePath(); |
| 132 | 132 |
| 133 void main() { | 133 void main() { |
| 134 if (Platform.environment.containsKey('SCRIPT')) { | 134 if (Platform.environment.containsKey('SCRIPT')) { |
| 135 print(Platform.executable); | 135 print(Platform.executable); |
| 136 return; | 136 return; |
| 137 } | 137 } |
| 138 | 138 |
| 139 testDartExecShouldNotBeInCurrentDir(); | 139 testDartExecShouldNotBeInCurrentDir(); |
| 140 testShouldFailOutsidePath(); | |
| 141 testShouldSucceedWithSourcePlatformExecutable(); /// 00: ok | 140 testShouldSucceedWithSourcePlatformExecutable(); /// 00: ok |
| 142 withTempDir(testExeSymLinked); /// 01: ok | 141 withTempDir(testExeSymLinked); /// 01: ok |
| 143 withTempDir(testExeDirSymLinked); /// 02: ok | 142 withTempDir(testExeDirSymLinked); /// 02: ok |
| 144 testPathToSDKDir(); /// 03: ok | 143 testPathToSDKDir(); /// 03: ok |
| 145 withTempDir(testPathPointsToSymLinkedSDKPath); /// 04: ok | 144 withTempDir(testPathPointsToSymLinkedSDKPath); /// 04: ok |
| 146 withTempDir(testPathToDirWithExeSymLinked); /// 05: ok | 145 withTempDir(testPathToDirWithExeSymLinked); /// 05: ok |
| 146 testShouldFailOutsidePath(); /// 06: ok |
| 147 } | 147 } |
| OLD | NEW |