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

Unified Diff: tests/corelib/duration_test.dart

Issue 119263002: Fix bug in Duration.toString. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « sdk/lib/core/duration.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/duration_test.dart
diff --git a/tests/corelib/duration_test.dart b/tests/corelib/duration_test.dart
index 611161549e9310e9c62c0845e46943ffe2d07dcc..306873db87ef2adb7654a70cdc2062c7475f4f5d 100644
--- a/tests/corelib/duration_test.dart
+++ b/tests/corelib/duration_test.dart
@@ -225,4 +225,46 @@ main() {
d = const Duration(hours: -1999, minutes: -17, seconds: -42);
Expect.equals("-1999:17:42.000000", d.toString());
+
+ // Edge conditions for toString of microseconds.
+ // Regression test for http://dartbug.com/15678
+
+ d = const Duration(microseconds: 1);
+ Expect.equals("0:00:00.000001", d.toString());
+
+ d = const Duration(microseconds: 9);
+ Expect.equals("0:00:00.000009", d.toString());
+
+ d = const Duration(microseconds: 10);
+ Expect.equals("0:00:00.000010", d.toString());
+
+ d = const Duration(microseconds: 99);
+ Expect.equals("0:00:00.000099", d.toString());
+
+ d = const Duration(microseconds: 100);
+ Expect.equals("0:00:00.000100", d.toString());
+
+ d = const Duration(microseconds: 999);
+ Expect.equals("0:00:00.000999", d.toString());
+
+ d = const Duration(microseconds: 1000);
+ Expect.equals("0:00:00.001000", d.toString());
+
+ d = const Duration(microseconds: 9999);
+ Expect.equals("0:00:00.009999", d.toString());
+
+ d = const Duration(microseconds: 10000);
+ Expect.equals("0:00:00.010000", d.toString());
+
+ d = const Duration(microseconds: 99999);
+ Expect.equals("0:00:00.099999", d.toString());
+
+ d = const Duration(microseconds: 100000);
+ Expect.equals("0:00:00.100000", d.toString());
+
+ d = const Duration(microseconds: 999999);
+ Expect.equals("0:00:00.999999", d.toString());
+
+ d = const Duration(microseconds: 1000000);
+ Expect.equals("0:00:01.000000", d.toString());
}
« no previous file with comments | « sdk/lib/core/duration.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698