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 'package:scheduled_test/descriptor.dart' as d; |
8 | 8 import 'package:scheduled_test/scheduled_stream.dart'; |
9 import 'package:path/path.dart' as p; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
10 import 'package:test/src/util/io.dart'; | |
11 import 'package:test/test.dart'; | |
12 | 10 |
13 import '../../io.dart'; | 11 import '../../io.dart'; |
14 | 12 |
15 String _sandbox; | |
16 | |
17 void main() { | 13 void main() { |
18 setUp(() { | 14 useSandbox(); |
19 _sandbox = createTempDir(); | |
20 }); | |
21 | |
22 tearDown(() { | |
23 new Directory(_sandbox).deleteSync(recursive: true); | |
24 }); | |
25 | 15 |
26 test("prints the platform name when running on multiple platforms", () { | 16 test("prints the platform name when running on multiple platforms", () { |
27 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 17 d.file("test.dart", """ |
28 import 'dart:async'; | 18 import 'dart:async'; |
29 | 19 |
30 import 'package:path/path.dart' as p; | |
31 import 'package:test/test.dart'; | 20 import 'package:test/test.dart'; |
32 | 21 |
33 void main() { | 22 void main() { |
34 test("success", () {}); | 23 test("success", () {}); |
35 } | 24 } |
36 """); | 25 """).create(); |
37 | 26 |
38 var result = _runTest([ | 27 var test = runTest([ |
39 "-r", | 28 "-r", "expanded", |
40 "expanded", | 29 "-p", "content-shell", |
41 "-p", | 30 "-p", "vm", |
42 "content-shell", | 31 "-j", "1", |
43 "-p", | |
44 "vm", | |
45 "-j", | |
46 "1", | |
47 "test.dart" | 32 "test.dart" |
48 ]); | 33 ]); |
49 expect(result.stdout, contains("[VM]")); | 34 |
50 expect(result.stdout, contains("[Dartium Content Shell]")); | 35 test.stdout.fork().expect(consumeThrough(contains("[VM]"))); |
51 expect(result.exitCode, equals(0)); | 36 test.stdout.expect(consumeThrough(contains("[Dartium Content Shell]"))); |
| 37 test.shouldExit(0); |
52 }); | 38 }); |
53 } | 39 } |
54 | |
55 ProcessResult _runTest(List<String> args) => | |
56 runTest(args, workingDirectory: _sandbox); | |
OLD | NEW |