Bug 671533 - Fix test_DownloadUtils.js with locales with a different decimal separator. r=edilee

This commit is contained in:
Mike Hommey 2011-07-15 10:15:28 +02:00
parent cffb64ce25
commit a5100b7641

View File

@ -39,7 +39,7 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
const gDecimalSymbol = Number(5.4).toLocaleString().match(/\D/);
function _(str) {
return str.replace(".", gDecimalSymbol);
return str.replace(".", gDecimalSymbol, "g");
}
function testConvertByteUnits(aBytes, aValue, aUnit)
@ -76,7 +76,7 @@ function testStatus(aCurr, aMore, aRate, aTest)
}
// Make sure the status text matches
do_check_eq(status, aTest[0].replace(/--/, gDash));
do_check_eq(status, _(aTest[0].replace(/--/, gDash)));
// Make sure the lastSeconds matches
if (last == Infinity)
@ -113,6 +113,7 @@ function run_test()
testTransferTotal(1, 1, _("1 of 1 bytes"));
testTransferTotal(234, 4924, _("234 bytes of 4.8 KB"));
testTransferTotal(94923, 233923, _("92.7 of 228 KB"));
testTransferTotal(4924, 94923, _("4.8 of 92.7 KB"));
testTransferTotal(2342, 294960345, _("2.3 KB of 281 MB"));
testTransferTotal(234, undefined, _("234 bytes"));
testTransferTotal(4889023, undefined, _("4.7 MB"));