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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 | 7 |
8 main() { | 8 main() { |
9 Expect.isTrue(Platform.numberOfProcessors > 0); | 9 Expect.isTrue(Platform.numberOfProcessors > 0); |
10 var os = Platform.operatingSystem; | 10 var os = Platform.operatingSystem; |
11 Expect.isTrue(os == "android" || os == "linux" || os == "macos" || | 11 Expect.isTrue(os == "android" || os == "linux" || os == "macos" || |
12 os == "windows"); | 12 os == "windows"); |
13 Expect.equals(Platform.isLinux, Platform.operatingSystem == "linux"); | 13 Expect.equals(Platform.isLinux, Platform.operatingSystem == "linux"); |
14 Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos"); | 14 Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos"); |
15 Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows"); | 15 Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows"); |
16 Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android"); | 16 Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android"); |
17 var sep = Platform.pathSeparator; | 17 var sep = Platform.pathSeparator; |
18 Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\')); | 18 Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\')); |
19 var hostname = Platform.localHostname; | 19 var hostname = Platform.localHostname; |
20 Expect.isTrue(hostname is String && hostname != ""); | 20 Expect.isTrue(hostname is String && hostname != ""); |
21 var environment = Platform.environment; | 21 var environment = Platform.environment; |
22 Expect.isTrue(environment is Map<String, String>); | 22 Expect.isTrue(environment is Map<String, String>); |
| 23 Expect.isTrue(Platform.executable.contains('dart')); |
| 24 Expect.isTrue(Platform.script.replaceAll('\\', '/'). |
| 25 endsWith('tests/standalone/io/platform_test.dart')); |
23 } | 26 } |
OLD | NEW |