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

Side by Side Diff: tests/standalone/io/platform_executable_test.dart

Issue 1178643007: Resolve the executable path on Mac OS when sym-linked (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Added a few comments Created 5 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 unified diff | Download patch
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 link.createSync(exeFile.parent.path); 100 link.createSync(exeFile.parent.path);
101 101
102 //print('*** Path points to a sym-linked SDK dir'); 102 //print('*** Path points to a sym-linked SDK dir');
103 verify(platformExeName, altPath: link.path); 103 verify(platformExeName, altPath: link.path);
104 } 104 }
105 105
106 void testPathToSDKDir() { 106 void testPathToSDKDir() {
107 var exeFile = new File(Platform.executable); 107 var exeFile = new File(Platform.executable);
108 var binDirPath = exeFile.parent.path; 108 var binDirPath = exeFile.parent.path;
109 109
110 //print('*** Running with PATH env set to environment - fixed in 16994 - thank s!'); 110 //print('*** Running with PATH env set to environment - fixed in 16994 - thank s!');
kustermann 2015/06/11 18:34:27 long line
Søren Gjesse 2015/06/12 07:24:24 I removed all the print in comments in the file.
111 verify(platformExeName, altPath: binDirPath); 111 verify(platformExeName, altPath: binDirPath);
112 } 112 }
113 113
114 void withTempDir(void test(Directory dir)) { 114 void withTempDir(void test(Directory dir)) {
115 var tempDir = Directory.systemTemp.createTempSync('dart.sdk.test.'); 115 var tempDir = Directory.systemTemp.createTempSync('dart.sdk.test.');
116 try { 116 try {
117 test(tempDir); 117 test(tempDir);
118 } finally { 118 } finally {
119 tempDir.deleteSync(recursive: true); 119 tempDir.deleteSync(recursive: true);
120 } 120 }
121 } 121 }
122 122
123 String get platformExeName { 123 String get platformExeName {
124 var raw = new Uri.file(Platform.executable); 124 var raw = new Uri.file(Platform.executable);
125 return raw.pathSegments.last; 125 return raw.pathSegments.last;
126 } 126 }
127 127
128 String get scriptPath => Platform.script.toFilePath(); 128 String get scriptPath => Platform.script.toFilePath();
129 129
130 void main() { 130 void main() {
131 if (Platform.environment.containsKey(_SCRIPT_KEY)) { 131 if (Platform.environment.containsKey(_SCRIPT_KEY)) {
132 print(Platform.executable); 132 print(Platform.executable);
133 return; 133 return;
134 } 134 }
135 135
136 testDartExecShouldNotBeInCurrentDir(); 136 testDartExecShouldNotBeInCurrentDir();
137 testShouldSucceedWithSourcePlatformExecutable(); /// 00: ok 137 testShouldSucceedWithSourcePlatformExecutable(); /// 00: ok
138 withTempDir(testExeSymLinked); /// 01: ok 138 // dart:io does not support linking to files in Windows.
139 if (!Platform.isWindows) {
140 withTempDir(testExeSymLinked); /// 01: ok
141 }
139 withTempDir(testExeDirSymLinked); /// 02: ok 142 withTempDir(testExeDirSymLinked); /// 02: ok
140 testPathToSDKDir(); /// 03: ok 143 testPathToSDKDir(); /// 03: ok
141 withTempDir(testPathPointsToSymLinkedSDKPath); /// 04: ok 144 withTempDir(testPathPointsToSymLinkedSDKPath); /// 04: ok
142 withTempDir(testPathToDirWithExeSymLinked); /// 05: ok 145 // dart:io does not support linking to files in Windows.
146 if (!Platform.isWindows) {
147 withTempDir(testPathToDirWithExeSymLinked); /// 05: ok
148 }
143 testShouldSucceedWithEmptyPathEnvironment(); /// 06: ok 149 testShouldSucceedWithEmptyPathEnvironment(); /// 06: ok
144 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698