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:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
11 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
12 | 12 |
13 import '../io.dart'; | 13 import '../io.dart'; |
14 | 14 |
15 void main() { | 15 void main() { |
16 test("reports when no tests are run", () { | 16 test("reports when no tests are run", () { |
17 return withTempDir((path) { | 17 return withTempDir((path) { |
18 new File(p.join(path, "test.dart")).writeAsStringSync("void main() {}"); | 18 new File(p.join(path, "test.dart")).writeAsStringSync("void main() {}"); |
19 var result = runTest(["-r", "expanded", "test.dart"], | 19 var result = runTest(["-r", "expanded", "test.dart"], |
20 workingDirectory: path); | 20 workingDirectory: path); |
21 expect(result.stdout, equals("No tests ran.\n")); | 21 expect(result.stdout, contains("No tests ran.")); |
22 }); | 22 }); |
23 }); | 23 }); |
24 | 24 |
25 test("runs several successful tests and reports when each completes", () { | 25 test("runs several successful tests and reports when each completes", () { |
26 _expectReport(""" | 26 _expectReport(""" |
27 test('success 1', () {}); | 27 test('success 1', () {}); |
28 test('success 2', () {}); | 28 test('success 2', () {}); |
29 test('success 3', () {});""", | 29 test('success 3', () {});""", |
30 """ | 30 """ |
31 +0: success 1 | 31 +0: success 1 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Un-indent the expected string. | 330 // Un-indent the expected string. |
331 var indentation = expected.indexOf(new RegExp("[^ ]")); | 331 var indentation = expected.indexOf(new RegExp("[^ ]")); |
332 expected = expected.split("\n").map((line) { | 332 expected = expected.split("\n").map((line) { |
333 if (line.isEmpty) return line; | 333 if (line.isEmpty) return line; |
334 return line.substring(indentation); | 334 return line.substring(indentation); |
335 }).join("\n"); | 335 }).join("\n"); |
336 | 336 |
337 expect(actual, equals(expected)); | 337 expect(actual, equals(expected)); |
338 }), completes); | 338 }), completes); |
339 } | 339 } |
OLD | NEW |