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

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

Issue 1180623006: Revert change to Platform.excutable and add Platform.resolvedExecutable (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated dart2js io_patch.dart 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 import "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 11
12 test() { 12 test() {
13 Expect.isTrue(Platform.numberOfProcessors > 0); 13 Expect.isTrue(Platform.numberOfProcessors > 0);
14 var os = Platform.operatingSystem; 14 var os = Platform.operatingSystem;
15 Expect.isTrue(os == "android" || os == "linux" || os == "macos" || 15 Expect.isTrue(os == "android" || os == "linux" || os == "macos" ||
16 os == "windows"); 16 os == "windows");
17 Expect.equals(Platform.isLinux, Platform.operatingSystem == "linux"); 17 Expect.equals(Platform.isLinux, Platform.operatingSystem == "linux");
18 Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos"); 18 Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos");
19 Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows"); 19 Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows");
20 Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android"); 20 Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android");
21 var sep = Platform.pathSeparator; 21 var sep = Platform.pathSeparator;
22 Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\')); 22 Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\'));
23 var hostname = Platform.localHostname; 23 var hostname = Platform.localHostname;
24 Expect.isTrue(hostname is String && hostname != ""); 24 Expect.isTrue(hostname is String && hostname != "");
25 var environment = Platform.environment; 25 var environment = Platform.environment;
26 Expect.isTrue(environment is Map<String, String>); 26 Expect.isTrue(environment is Map<String, String>);
27 Expect.isTrue(Platform.executable.contains('dart'));
28 if (!Platform.isWindows) { 27 if (!Platform.isWindows) {
29 Expect.isTrue(Platform.executable.startsWith('/')); 28 Expect.isTrue(Platform.executable.endsWith('dart'));
29 Expect.isTrue(Platform.resolvedExecutable.endsWith('dart'));
30 } else {
31 Expect.isTrue(Platform.executable.endsWith('dart.exe'));
32 Expect.isTrue(Platform.resolvedExecutable.endsWith('dart.exe'));
33 }
34 if (!Platform.isWindows) {
35 Expect.isTrue(Platform.resolvedExecutable.startsWith('/'));
30 } else { 36 } else {
31 // This assumes that tests (both locally and on the bots) are 37 // This assumes that tests (both locally and on the bots) are
32 // running off a location referred to by a drive letter. If a UNC 38 // running off a location referred to by a drive letter. If a UNC
33 // location is used or long names ("\\?\" prefix) is used this 39 // location is used or long names ("\\?\" prefix) is used this
34 // needs to be fixed. 40 // needs to be fixed.
35 Expect.equals(Platform.executable.substring(1, 3), ':\\'); 41 Expect.equals(Platform.executable.substring(1, 3), ':\\');
36 } 42 }
37 // Move directory to be sure script is correct. 43 // Move directory to be sure script is correct.
38 var oldDir = Directory.current; 44 var oldDir = Directory.current;
39 Directory.current = Directory.current.parent; 45 Directory.current = Directory.current.parent;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 Expect.throws(() => checkValidVersion('x.y.z')); 132 Expect.throws(() => checkValidVersion('x.y.z'));
127 } 133 }
128 134
129 main() { 135 main() {
130 // This tests assumes paths relative to dart main directory 136 // This tests assumes paths relative to dart main directory
131 Directory.current = Platform.script.resolve('../../..').toFilePath(); 137 Directory.current = Platform.script.resolve('../../..').toFilePath();
132 test(); 138 test();
133 testIsolate(); 139 testIsolate();
134 testVersion(); 140 testVersion();
135 } 141 }
OLDNEW
« no previous file with comments | « tests/standalone/io/platform_resolved_executable_test.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698