Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: test/runner/compact_reporter_test.dart

Issue 1100873005: Add a --reporter flag and expose the expanded reporter. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(["test.dart"], workingDirectory: path); 19 var result = runTest(["-r", "compact", "test.dart"],
20 workingDirectory: path);
20 expect(result.stdout, equals("No tests ran.\n")); 21 expect(result.stdout, equals("No tests ran.\n"));
21 }); 22 });
22 }); 23 });
23 24
24 test("runs several successful tests and reports when each completes", () { 25 test("runs several successful tests and reports when each completes", () {
25 _expectReport(""" 26 _expectReport("""
26 test('success 1', () {}); 27 test('success 1', () {});
27 test('success 2', () {}); 28 test('success 2', () {});
28 test('success 3', () {});""", 29 test('success 3', () {});""",
29 """ 30 """
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 import 'package:test/test.dart'; 326 import 'package:test/test.dart';
326 327
327 void main() { 328 void main() {
328 $tests 329 $tests
329 } 330 }
330 """; 331 """;
331 332
332 expect(withTempDir((path) { 333 expect(withTempDir((path) {
333 new File(p.join(path, "test.dart")).writeAsStringSync(dart); 334 new File(p.join(path, "test.dart")).writeAsStringSync(dart);
334 if (args == null) args = []; 335 if (args == null) args = [];
335 args = args.toList()..add("test.dart"); 336 args = args.toList()
336 args.add("--concurrency=$concurrency"); 337 ..add("test.dart")
338 ..add("--concurrency=$concurrency")
339 ..add("--reporter=compact");
337 var result = runTest(args, workingDirectory: path); 340 var result = runTest(args, workingDirectory: path);
338 341
339 // Convert CRs into newlines, remove excess trailing whitespace, and trim 342 // Convert CRs into newlines, remove excess trailing whitespace, and trim
340 // off timestamps. 343 // off timestamps.
341 var actual = result.stdout.trim().split(new RegExp(r"[\r\n]")).map((line) { 344 var actual = result.stdout.trim().split(new RegExp(r"[\r\n]")).map((line) {
342 if (line.startsWith(" ") || line.isEmpty) return line.trimRight(); 345 if (line.startsWith(" ") || line.isEmpty) return line.trimRight();
343 return line.trim().replaceFirst(new RegExp("^[0-9]{2}:[0-9]{2} "), ""); 346 return line.trim().replaceFirst(new RegExp("^[0-9]{2}:[0-9]{2} "), "");
344 }).join("\n"); 347 }).join("\n");
345 348
346 // Un-indent the expected string. 349 // Un-indent the expected string.
347 var indentation = expected.indexOf(new RegExp("[^ ]")); 350 var indentation = expected.indexOf(new RegExp("[^ ]"));
348 expected = expected.split("\n").map((line) { 351 expected = expected.split("\n").map((line) {
349 if (line.isEmpty) return line; 352 if (line.isEmpty) return line;
350 return line.substring(indentation); 353 return line.substring(indentation);
351 }).join("\n"); 354 }).join("\n");
352 355
353 expect(actual, equals(expected)); 356 expect(actual, equals(expected));
354 }), completes); 357 }), completes);
355 } 358 }
OLDNEW
« no previous file with comments | « test/runner/browser/expanded_reporter_test.dart ('k') | test/runner/expanded_reporter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698