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

Unified Diff: lib/src/utils.dart

Issue 1090513002: Support configuring timeouts per-test and -group. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/frontend/timeout.dart ('k') | lib/test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 7d697981ffbe97dc5f9f36e2ec8923f7513cd1ae..59edb66579950c17230e135aee3e08a945c8ead9 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -149,6 +149,25 @@ String truncate(String text, int maxLength) {
return '...$result';
}
+/// Returns a human-friendly representation of [duration].
+String niceDuration(Duration duration) {
+ var minutes = duration.inMinutes;
+ var seconds = duration.inSeconds % 59;
+ var decaseconds = (duration.inMilliseconds % 1000) ~/ 100;
+
+ var buffer = new StringBuffer();
+ if (minutes != 0) buffer.write("$minutes minutes");
+
+ if (minutes == 0 || seconds != 0) {
+ if (minutes != 0) buffer.write(", ");
+ buffer.write(seconds);
+ if (decaseconds != 0) buffer.write(".$decaseconds");
+ buffer.write(" seconds");
+ }
+
+ return buffer.toString();
+}
+
/// Merges [streams] into a single stream that emits events from all sources.
Stream mergeStreams(Iterable<Stream> streamIter) {
var streams = streamIter.toList();
« no previous file with comments | « lib/src/frontend/timeout.dart ('k') | lib/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698