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") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:test/test.dart'; |
11 | 11 |
12 import '../../io.dart'; | 12 import '../../io.dart'; |
13 | 13 |
14 String _sandbox; | 14 String _sandbox; |
15 | 15 |
16 void main() { | 16 void main() { |
17 setUp(() { | 17 setUp(() { |
18 _sandbox = Directory.systemTemp.createTempSync('unittest_').path; | 18 _sandbox = Directory.systemTemp.createTempSync('test_').path; |
19 }); | 19 }); |
20 | 20 |
21 tearDown(() { | 21 tearDown(() { |
22 new Directory(_sandbox).deleteSync(recursive: true); | 22 new Directory(_sandbox).deleteSync(recursive: true); |
23 }); | 23 }); |
24 | 24 |
25 test("prints the platform name when running on multiple platforms", () { | 25 test("prints the platform name when running on multiple platforms", () { |
26 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 26 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" |
27 import 'dart:async'; | 27 import 'dart:async'; |
28 | 28 |
29 import 'package:path/path.dart' as p; | 29 import 'package:path/path.dart' as p; |
30 import 'package:unittest/unittest.dart'; | 30 import 'package:test/test.dart'; |
31 | 31 |
32 void main() { | 32 void main() { |
33 test("success", () {}); | 33 test("success", () {}); |
34 } | 34 } |
35 """); | 35 """); |
36 | 36 |
37 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); | 37 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); |
38 expect(result.stdout, contains("[VM]")); | 38 expect(result.stdout, contains("[VM]")); |
39 expect(result.stdout, contains("[Chrome]")); | 39 expect(result.stdout, contains("[Chrome]")); |
40 expect(result.exitCode, equals(0)); | 40 expect(result.exitCode, equals(0)); |
41 }); | 41 }); |
42 } | 42 } |
43 | 43 |
44 ProcessResult _runUnittest(List<String> args) => | 44 ProcessResult _runUnittest(List<String> args) => |
45 runUnittest(args, workingDirectory: _sandbox); | 45 runUnittest(args, workingDirectory: _sandbox); |
OLD | NEW |