Bug 1301655 - pt 9 - Update test_bug22310.js to remove use of nsIScriptableDateFormat. r=gandalf
authorJonathan Kew <jkew@mozilla.com>
Fri, 28 Oct 2016 12:04:07 +0100
changeset 319996 58dbf93c50dafeadab27fced867ab2b2717e57db
parent 319995 8e2d25bd70b8412864e5005ea4099eb53f183d5c
child 319997 3198f930b755ff943d1ab0e1f5c422b0801db625
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgandalf
bugs1301655, 22310
milestone52.0a1
Bug 1301655 - pt 9 - Update test_bug22310.js to remove use of nsIScriptableDateFormat. r=gandalf
intl/locale/tests/unit/test_bug22310.js
--- a/intl/locale/tests/unit/test_bug22310.js
+++ b/intl/locale/tests/unit/test_bug22310.js
@@ -1,36 +1,37 @@
 String.prototype.has = function(s) { return this.indexOf(s) != -1; }
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 
-const dts = Cc["@mozilla.org/intl/scriptabledateformat;1"]
-        .getService(Ci.nsIScriptableDateFormat);
-
 function dt(locale) {
-  return dts.FormatDateTime(locale, dts.dateFormatLong,
-                            dts.timeFormatSeconds, 2008, 6, 30, 13, 56, 34);
+  var date = new Date("2008-06-30T13:56:34");
+  const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
+                      hour: 'numeric', minute: 'numeric', second: 'numeric' };
+  return date.toLocaleString(locale, dtOptions);
 }
 
 var all_passed = true;
 const tests = 
 [
  [dt("en-US").has("June"), "month name in en-US"],
  [dt("en-US").has("2008"), "year in en-US"],
  [dt("da").has("jun"), "month name in da"],
  [dt("da-DK") == dt("da"), "da same as da-DK"],
  [dt("en-GB").has("30") && dt("en-GB").has("June") &&
    dt("en-GB").indexOf("30") < dt("en-GB").indexOf("June"),
   "day before month in en-GB"],
  [dt("en-US").has("30") && dt("en-US").has("June") &&
    dt("en-US").indexOf("30") > dt("en-US").indexOf("June"),
   "month before day in en-US"],
  [dt("ja-JP").has("\u5E746\u670830\u65E5"), "year month and day in ja-JP"],
- [dt("ja-JP") == dt("ja-JP-mac"), "ja-JP-mac same as ja-JP"],
+ // The Firefox locale code ja-JP-mac will be resolved to a BCP47-compliant
+ // tag ja-JP-x-lvariant-mac by uloc_toLanguageTag
+ [dt("ja-JP") == dt("ja-JP-x-lvariant-mac"), "ja-JP-x-lvariant-mac same as ja-JP"],
  [dt("nn-NO").has("juni"), "month name in nn-NO"],
  [dt("nb-NO").has("juni"), "month name in nb-NO"],
  // Bug 1261775 - failures on win10
  //[dt("no-NO").has("30. juni"), "month name in no-NO"],
  [dt("sv-SE").has("30 jun"), "month name in sv-SE"],
  [dt("kok").has("\u091C\u0942\u0928"), "month name in kok"],
  [dt("ta-IN").has("\u0B9C\u0BC2\u0BA9\u0BCD"), "month name in ta-IN"],
  [dt("ab-CD").length > 0, "fallback for ab-CD"]