Fixed degrade i18n for time span.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7134 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
cactusman committed 2008-02-15 02:33:34 +00:00
1 parent bb921f4320
commit f12d71c8e3
4 files changed
+28 -25

No files matched your search

+7 -6
View File
@@ -37,17 +37,18 @@ public class UtilTest extends TestCase {
// We're still working on the assumption that a month is 30 days, so there will
// be 5 days at the end of the year that will be "12 months" but not "1 year".
// First check 359 days.
assertEquals("11 months", Util.getTimeSpanString(31017600000L));
assertEquals("11 " + Messages.Util_month(), Util.getTimeSpanString(31017600000L));
// And 362 days.
assertEquals("12 months", Util.getTimeSpanString(31276800000L));
assertEquals("12 " + Messages.Util_month(), Util.getTimeSpanString(31276800000L));
// 11.25 years - Check that if the first unit has 2 or more digits, a second unit isn't used.
assertEquals("11 years", Util.getTimeSpanString(354780000000L));
assertEquals("11 " + Messages.Util_year(), Util.getTimeSpanString(354780000000L));
// 9.25 years - Check that if the first unit has only 1 digit, a second unit is used.
assertEquals("9 years 3 months", Util.getTimeSpanString(291708000000L));
assertEquals("9 " + Messages.Util_year() + " 3 " + Messages.Util_month(), Util.getTimeSpanString(291708000000L));
// 67 seconds
assertEquals("1 minute 7 seconds", Util.getTimeSpanString(67000L));
assertEquals("1 " + Messages.Util_minute() + " 7 " + Messages.Util_second(), Util.getTimeSpanString(67000L));
// 17 seconds - Check that times less than a minute only use seconds.
assertEquals("17 seconds", Util.getTimeSpanString(17000L));
assertEquals("17 " + Messages.Util_second(), Util.getTimeSpanString(17000L));
}
}