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 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')); | 27 Expect.isTrue(Platform.executable.contains('dart')); |
28 Expect.isTrue(Platform.resolvedExecutable.contains('dart')); | |
Lasse Reichstein Nielsen
2015/06/12 14:12:17
This is making a lot of assumptions. A *lot* - lik
Søren Gjesse
2015/06/15 07:28:15
Sure this is not testing that much. Changed it a b
| |
28 if (!Platform.isWindows) { | 29 if (!Platform.isWindows) { |
29 Expect.isTrue(Platform.executable.startsWith('/')); | 30 Expect.isTrue(Platform.resolvedExecutable.startsWith('/')); |
30 } else { | 31 } else { |
31 // This assumes that tests (both locally and on the bots) are | 32 // 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 | 33 // running off a location referred to by a drive letter. If a UNC |
33 // location is used or long names ("\\?\" prefix) is used this | 34 // location is used or long names ("\\?\" prefix) is used this |
34 // needs to be fixed. | 35 // needs to be fixed. |
35 Expect.equals(Platform.executable.substring(1, 3), ':\\'); | 36 Expect.equals(Platform.executable.substring(1, 3), ':\\'); |
36 } | 37 } |
37 // Move directory to be sure script is correct. | 38 // Move directory to be sure script is correct. |
38 var oldDir = Directory.current; | 39 var oldDir = Directory.current; |
39 Directory.current = Directory.current.parent; | 40 Directory.current = Directory.current.parent; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 Expect.throws(() => checkValidVersion('x.y.z')); | 127 Expect.throws(() => checkValidVersion('x.y.z')); |
127 } | 128 } |
128 | 129 |
129 main() { | 130 main() { |
130 // This tests assumes paths relative to dart main directory | 131 // This tests assumes paths relative to dart main directory |
131 Directory.current = Platform.script.resolve('../../..').toFilePath(); | 132 Directory.current = Platform.script.resolve('../../..').toFilePath(); |
132 test(); | 133 test(); |
133 testIsolate(); | 134 testIsolate(); |
134 testVersion(); | 135 testVersion(); |
135 } | 136 } |
OLD | NEW |