OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") |
| 6 |
5 import 'dart:io'; | 7 import 'dart:io'; |
6 | 8 |
7 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
8 import 'package:unittest/src/backend/operating_system.dart'; | 10 import 'package:unittest/src/backend/operating_system.dart'; |
9 import 'package:unittest/src/backend/platform_selector.dart'; | 11 import 'package:unittest/src/backend/platform_selector.dart'; |
10 import 'package:unittest/src/backend/test_platform.dart'; | 12 import 'package:unittest/src/backend/test_platform.dart'; |
11 | 13 |
12 void main() { | 14 void main() { |
13 test("new PlatformSelector.parse() disallows invalid variables", () { | 15 test("new PlatformSelector.parse() disallows invalid variables", () { |
14 expect(() => new PlatformSelector.parse("undefined"), | 16 expect(() => new PlatformSelector.parse("undefined"), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 /// Returns the result of evaluating [expression] on [platform] and [os]. | 133 /// Returns the result of evaluating [expression] on [platform] and [os]. |
132 /// | 134 /// |
133 /// [platform] defaults to [TestPlatform.vm]; [os] defaults to the current | 135 /// [platform] defaults to [TestPlatform.vm]; [os] defaults to the current |
134 /// operating system. | 136 /// operating system. |
135 bool _eval(String expression, {TestPlatform platform, OperatingSystem os}) { | 137 bool _eval(String expression, {TestPlatform platform, OperatingSystem os}) { |
136 if (platform == null) platform = TestPlatform.vm; | 138 if (platform == null) platform = TestPlatform.vm; |
137 if (os == null) os = OperatingSystem.findByIoName(Platform.operatingSystem); | 139 if (os == null) os = OperatingSystem.findByIoName(Platform.operatingSystem); |
138 var selector = new PlatformSelector.parse(expression); | 140 var selector = new PlatformSelector.parse(expression); |
139 return selector.evaluate(platform, os: os); | 141 return selector.evaluate(platform, os: os); |
140 } | 142 } |
OLD | NEW |