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

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

Issue 1212313005: Continuously update the compact reporter's clock. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « lib/src/runner/reporter/compact.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 new File(p.join(path, "test.dart")).writeAsStringSync(dart); 362 new File(p.join(path, "test.dart")).writeAsStringSync(dart);
363 if (args == null) args = []; 363 if (args == null) args = [];
364 args = args.toList() 364 args = args.toList()
365 ..add("test.dart") 365 ..add("test.dart")
366 ..add("--concurrency=$concurrency") 366 ..add("--concurrency=$concurrency")
367 ..add("--reporter=compact"); 367 ..add("--reporter=compact");
368 var result = runTest(args, workingDirectory: path); 368 var result = runTest(args, workingDirectory: path);
369 369
370 // Convert CRs into newlines, remove excess trailing whitespace, and trim 370 // Convert CRs into newlines, remove excess trailing whitespace, and trim
371 // off timestamps. 371 // off timestamps.
372 var lastLine;
372 var actual = result.stdout.trim().split(new RegExp(r"[\r\n]")).map((line) { 373 var actual = result.stdout.trim().split(new RegExp(r"[\r\n]")).map((line) {
373 if (line.startsWith(" ") || line.isEmpty) return line.trimRight(); 374 if (line.startsWith(" ") || line.isEmpty) return line.trimRight();
374 return line.trim().replaceFirst(new RegExp("^[0-9]{2}:[0-9]{2} "), ""); 375
375 }).join("\n"); 376 var trimmed = line.trim()
377 .replaceFirst(new RegExp("^[0-9]{2}:[0-9]{2} "), "");
378
379 // Trim identical lines so the test isn't dependent on how fast each test
380 // runs.
381 if (trimmed == lastLine) return null;
382 lastLine = trimmed;
383 return trimmed;
384 }).where((line) => line != null).join("\n");
376 385
377 // Un-indent the expected string. 386 // Un-indent the expected string.
378 var indentation = expected.indexOf(new RegExp("[^ ]")); 387 var indentation = expected.indexOf(new RegExp("[^ ]"));
379 expected = expected.split("\n").map((line) { 388 expected = expected.split("\n").map((line) {
380 if (line.isEmpty) return line; 389 if (line.isEmpty) return line;
381 return line.substring(indentation); 390 return line.substring(indentation);
382 }).join("\n"); 391 }).join("\n");
383 392
384 expect(actual, equals(expected)); 393 expect(actual, equals(expected));
385 }), completes); 394 }), completes);
386 } 395 }
OLDNEW
« no previous file with comments | « lib/src/runner/reporter/compact.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698