From ab220a0bf7684d4128823b64a7c14c9bcc143b65 Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Tue, 18 Aug 2020 17:50:26 +0900 Subject: [PATCH 1/8] Add test cases to verify be-BY(Belarusian-Belarus) --- js/test/date/testMeridiems.js | 10 + js/test/date/testMonthTranslation.js | 25 + js/test/date/testSuiteFiles.js | 1 + js/test/date/testWeekdayTranslation.js | 71 + js/test/date/testcalendar.js | 4 +- js/test/date/testclock.js | 9 + js/test/date/testdatefmt_be_BY.js | 1788 +++++++++++++++++++ js/test/date/testdatetimefmt.js | 26 + js/test/daterange/testSuiteFiles.js | 1 + js/test/daterange/testdatefmtrange_be_BY.js | 692 +++++++ js/test/durfmt/testdurfmt2.js | 53 + js/test/number/testcurrency.js | 9 + js/test/number/testnumfmt2.js | 19 + js/test/root/testlocaleinfo.js | 10 + js/test/root/testlocalematch.js | 43 + js/test/root/testscriptinfo.js | 10 + js/test/root/teststrings.js | 70 + js/test/strings-ext/testSuiteFiles.js | 1 + js/test/strings-ext/testlistfmt_be_BY.js | 253 +++ js/test/units/testmeasurement.js | 6 + js/test/units/testunitfmt.js | 24 + 21 files changed, 3123 insertions(+), 2 deletions(-) create mode 100644 js/test/date/testdatefmt_be_BY.js create mode 100644 js/test/daterange/testdatefmtrange_be_BY.js create mode 100644 js/test/strings-ext/testlistfmt_be_BY.js diff --git a/js/test/date/testMeridiems.js b/js/test/date/testMeridiems.js index 44fb518658..6cdf4450cc 100644 --- a/js/test/date/testMeridiems.js +++ b/js/test/date/testMeridiems.js @@ -1972,6 +1972,16 @@ module.exports.testmeridiems = { test.equal(fmt[0].name, "AM"); test.equal(fmt[1].name, "PM"); + test.done(); + }, + testMeridiem_be_BY: function(test) { + test.expect(3); + var fmt = DateFmt.getMeridiemsRange({locale:"be-BY"}); + test.ok(fmt !== null); + + test.equal(fmt[0].name, "AM"); + test.equal(fmt[1].name, "PM"); + test.done(); } } \ No newline at end of file diff --git a/js/test/date/testMonthTranslation.js b/js/test/date/testMonthTranslation.js index d468675dc9..ba4c276bc1 100644 --- a/js/test/date/testMonthTranslation.js +++ b/js/test/date/testMonthTranslation.js @@ -7315,6 +7315,31 @@ module.exports.testmonthtranslation = { test.equal(value[10], "ნოე"); test.equal(value[11], "დეკ"); + test.done(); + }, + testMonthTranslate_be_BY: function(test) { + test.expect(12); + + // full, long: MMMM + // short, medium: MM + + var value = [], i; + var fmt = new DateFmt({locale:"be-BY", date:"m", length: "full", useNative:false, timezone:"local"}) + for (i=0; i < 12; i++) { + value[i] = fmt.format(DateFactory({month:i+1, type:"gregorian"})); + } + test.equal(value[0], "студзень"); + test.equal(value[1], "люты"); + test.equal(value[2], "сакавік"); + test.equal(value[3], "красавік"); + test.equal(value[4], "май"); + test.equal(value[5], "чэрвень"); + test.equal(value[6], "ліпень"); + test.equal(value[7], "жнівень"); + test.equal(value[8], "верасень"); + test.equal(value[9], "кастрычнік"); + test.equal(value[10], "лістапад"); + test.equal(value[11], "снежань"); test.done(); } } diff --git a/js/test/date/testSuiteFiles.js b/js/test/date/testSuiteFiles.js index dbf16c1a08..e2fbea047f 100644 --- a/js/test/date/testSuiteFiles.js +++ b/js/test/date/testSuiteFiles.js @@ -36,6 +36,7 @@ module.exports.files = [ "testdatefmt_ar_SA.js", "testdatefmt_as_IN.js", "testdatefmt_az_Latn_AZ.js", + "testdatefmt_be_BY.js", "testdatefmt_bg.js", "testdatefmt_bn_IN.js", "testdatefmt_bs_Cyrl_BA.js", diff --git a/js/test/date/testWeekdayTranslation.js b/js/test/date/testWeekdayTranslation.js index ff7f370ff3..73686e5cbe 100644 --- a/js/test/date/testWeekdayTranslation.js +++ b/js/test/date/testWeekdayTranslation.js @@ -11222,6 +11222,77 @@ module.exports.testWeekdayTranslation = { test.equal(value[5], "პ"); test.equal(value[6], "შ"); + test.done(); + }, + testWeekdayTranslationFull_be_BY: function(test) { + // full -> wide + test.expect(7); + var fmt, value = [], i; + fmt = new DateFmt({locale:"be-BY", date:"w", length: "full", useNative:false, timezone:"local"}) + for (i=0; i < 7; i++) { + value[i] = fmt.format(DateFactory({year: 2015, month: 8, day:i+2, type:"gregorian"})); + } + test.equal(value[0], "нядзеля"); + test.equal(value[1], "панядзелак"); + test.equal(value[2], "аўторак"); + test.equal(value[3], "серада"); + test.equal(value[4], "чацвер"); + test.equal(value[5], "пятніца"); + test.equal(value[6], "субота"); + test.done(); + }, + testWeekdayTranslationLong_be_BY: function(test) { + // long -> abbreviate + test.expect(7); + var fmt, value = [], i; + fmt = new DateFmt({locale:"be-BY", date:"w", length: "long", useNative:false, timezone:"local"}) + for (i=0; i < 7; i++) { + value[i] = fmt.format(DateFactory({year: 2015, month: 8, day:i+2, type:"gregorian"})); + } + test.equal(value[0], "нд"); + test.equal(value[1], "пн"); + test.equal(value[2], "аў"); + test.equal(value[3], "ср"); + test.equal(value[4], "чц"); + test.equal(value[5], "пт"); + test.equal(value[6], "сб"); + + test.done(); + }, + testWeekdayTranslationMedium_be_BY: function(test) { + // medium -> short + test.expect(7); + var fmt, value = [], i; + fmt = new DateFmt({locale:"be-BY", date:"w", length: "medium", useNative:false, timezone:"local"}) + for (i=0; i < 7; i++) { + value[i] = fmt.format(DateFactory({year: 2015, month: 8, day:i+2, type:"gregorian"})); + } + test.equal(value[0], "нд"); + test.equal(value[1], "пн"); + test.equal(value[2], "аў"); + test.equal(value[3], "ср"); + test.equal(value[4], "чц"); + test.equal(value[5], "пт"); + test.equal(value[6], "сб"); + + test.done(); + }, + testWeekdayTranslationShort_be_BY: function(test) { + // short: narrow + test.expect(7); + var fmt, value = [], i; + fmt = new DateFmt({locale:"be-BY", date:"w", length: "short", useNative:false, timezone:"local"}) + for (i=0; i < 7; i++) { + value[i] = fmt.format(DateFactory({year: 2015, month: 8, day:i+2, type:"gregorian"})); + } + test.equal(value[0], "н"); + test.equal(value[1], "п"); + test.equal(value[2], "а"); + test.equal(value[3], "с"); + test.equal(value[4], "ч"); + test.equal(value[5], "п"); + test.equal(value[6], "с"); + test.done(); } } \ No newline at end of file diff --git a/js/test/date/testcalendar.js b/js/test/date/testcalendar.js index aa4593303b..a947bb59a1 100644 --- a/js/test/date/testcalendar.js +++ b/js/test/date/testcalendar.js @@ -23,9 +23,9 @@ if (typeof(LocaleInfo) === "undefined") { module.exports.testcalendar = { testDefaultCalendar_GregorianCaseAll: function(test) { - test.expect(193); + test.expect(194); var localeList = ["ar-AE","ar-BH","ar-DJ","ar-DZ","ar-EG","ar-IQ","ar-JO","ar-KW","ar-LB","ar-LY","ar-MA","ar-MR", - "ar-OM","ar-QA","ar-SA","ar-SD","ar-SY","ar-TN","ar-YE","as-IN","az-Latn-AZ","bg-BG","bn-IN","bs-Latn-BA,bs-Latn-ME", + "ar-OM","ar-QA","ar-SA","ar-SD","ar-SY","ar-TN","ar-YE","as-IN","az-Latn-AZ","be-BY","bg-BG","bn-IN","bs-Latn-BA,bs-Latn-ME", "cs-CZ","da-DK","de-AT","de-CH","de-DE","de-LU","et-EE","el-CY","el-GR","en-AM","en-AU","en-AZ","en-CA","en-GB","en-GH", "en-GM","en-HK","en-IE","en-IN","en-IS","en-JP","en-KE","en-KR","en-LK","en-LR","en-MM","en-MW","en-MY","en-NG","en-NZ", "en-PH","en-PK","en-PR","en-RW","en-SD","en-SG","en-SL","en-TW","en-TZ","en-UG","en-US","en-ZA","en-ZM","es-AR","es-BO", diff --git a/js/test/date/testclock.js b/js/test/date/testclock.js index f6cc085945..bb8840b636 100644 --- a/js/test/date/testclock.js +++ b/js/test/date/testclock.js @@ -1773,6 +1773,15 @@ module.exports.testclock = { test.equal(info.getClock(), 24); + test.done(); + }, + testClock_be_BY: function(test) { + test.expect(2); + var info = new LocaleInfo("be-BY"); + test.ok(info !== null); + + test.equal(info.getClock(), 24); + test.done(); } } diff --git a/js/test/date/testdatefmt_be_BY.js b/js/test/date/testdatefmt_be_BY.js new file mode 100644 index 0000000000..5b1d84c21c --- /dev/null +++ b/js/test/date/testdatefmt_be_BY.js @@ -0,0 +1,1788 @@ +/* + * testdatefmt_be_BY.js - test the date formatter object in Georgian + * + * Copyright © 2020, JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +if (typeof(JulianDate) === "undefined") { + var JulianDate = require("../../lib/JulianDate.js"); +} +if (typeof(GregorianDate) === "undefined") { + var GregorianDate = require("../../lib/GregorianDate.js"); +} +if (typeof(DateFmt) === "undefined") { + var DateFmt = require("../../lib/DateFmt.js"); +} +if (typeof(ilib) === "undefined") { + var ilib = require("../../lib/ilib.js"); +} + +module.exports.testdatefmt_be_BY = { + setUp: function(callback) { + ilib.clearCache(); + callback(); + }, + + testDateFmtConstructorEmpty_be_BY: function(test) { + test.expect(1); + var fmt = new DateFmt({locale: "be-BY"}); + + test.ok(fmt !== null); + test.done(); + }, + + testDateFmtSimpleShort_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "29.09.11"); + test.done(); + }, + + testDateFmtSimpleMedium_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "29.09.2011"); + test.done(); + }, + + testDateFmtSimpleLong_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "29 верасня 2011 г."); + test.done(); + }, + + testDateFmtSimpleFull_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29 верасня 2011 г.'); + test.done(); + }, + + testDateFmtSimpleTimeShort_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "short", type: "time"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '13:45'); + test.done(); + }, + + testDateFmtSimpleTimeMedium_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "medium", type: "time"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '13:45'); + test.done(); + }, + + testDateFmtSimpleTimeLong_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", timelength: "long", type: "time"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '13:45'); + test.done(); + }, + + testDateFmtSimpleTimeFull_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", type: "time"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 1, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '01:45'); + test.done(); + }, + + testDateFmtDateTimeSimpleShort_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "short", type: "datetime"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09.11, 13:45'); + test.done(); + }, + + testDateFmtDateTimeSimpleMedium_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "medium", type: "datetime"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09.2011, 13:45'); + test.done(); + }, + + testDateFmtDateTimeSimpleLong_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "long", type: "datetime"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29 верасня 2011 г. у 13:45'); + test.done(); + }, + + testDateFmtDateTimeSimpleFull_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", type: "datetime"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29 верасня 2011 г. у 13:45'); + test.done(); + }, + + + testDateFmtTemplateCalendar_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", calendar: "julian", template: "yyyy-MM-dd"}); + test.ok(fmt !== null); + + var date = new JulianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "2011-09-29"); + test.done(); + }, + + testDateFmtTemplateCalendarIncompatibleDateType_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", calendar: "julian", template: "yyyy-MM-dd HH:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + // convert automatically to a Julian calendar date + test.equal(fmt.format(date), "2011-09-16 13:45"); + test.done(); + }, + + testDateFmtTemplateClock12SwitchHH_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", clock: "12", template: "HH:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "01:45"); + test.done(); + }, + + testDateFmtTemplateClock12Switchkk_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", clock: "12", template: "kk:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "01:45"); + test.done(); + }, + + testDateFmtTemplateClock24Switchhh_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", clock: "24", template: "hh:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtTemplateClock24SwitchKK: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", clock: "24", template: "KK:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtTemplateNoClockDoNotFollowLocaleDefault12hh_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", template: "hh:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "01:45"); + test.done(); + }, + + testDateFmtTemplateNoClockDoNotFollowLocaleDefault12KK: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", template: "KK:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "01:45"); + test.done(); + }, + + testDateFmtTemplateNoClockDoNotFollowLocaleDefault24HH_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", template: "HH:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtTemplateNoClockDoNotFollowLocaleDefault24kk_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", template: "kk:mm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + + testDateFmtTypeDate_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "date"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09.11'); + test.done(); + }, + + testDateFmtTypeTime_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '13:45'); + test.done(); + }, + + testDateFmtTypeDateTime_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "datetime"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09.11, 13:45'); + test.done(); + }, + + testDateFmtShortDateComponentsY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "y"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "11"); + test.done(); + }, + + testDateFmtShortDateComponentsM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "m"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "ве"); + test.done(); + }, + + testDateFmtShortDateComponentsN_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "n"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'в'); + test.done(); + }, + + testDateFmtShortDateComponentsD_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "d"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "29"); + test.done(); + }, + + testDateFmtShortDateComponentsDM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "dm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09'); + test.done(); + }, + + testDateFmtShortDateComponentsMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "my"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '09.11'); + test.done(); + }, + + testDateFmtShortDateComponentsDMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "dmy"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29.09.11'); + test.done(); + }, + + testDateFmtShortDateComponentsWDM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "wdm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'ч, 29.09'); + test.done(); + }, + + testDateFmtShortDateComponentsWDMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "wdmy"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'ч, 29.09.11'); + test.done(); + }, + + testDateFmtLongDateComponentsWDM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", date: "wdm", length: "long"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'чц, 29 верасня'); + test.done(); + }, + + testDateFmtFullDateComponentsY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "y"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "2011"); + test.done(); + }, + + testDateFmtFullDateComponentsM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "m"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "верасень"); + test.done(); + }, + + testDateFmtFullDateComponentsD_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "d"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), "29"); + test.done(); + }, + + testDateFmtFullDateComponentsDM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "dm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29 верасня'); + test.done(); + }, + + testDateFmtFullDateComponentsMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "my"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'верасень 2011 г.'); + test.done(); + }, + + testDateFmtFullDateComponentsDMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "dmy"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), '29 верасня 2011 г.'); + test.done(); + }, + + testDateFmtFullDateComponentsWDM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "wdm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'чацвер, 29 верасня'); + test.done(); + }, + + testDateFmtFullDateComponentsWDMY_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full", date: "wdmy"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(date), 'чацвер, 29 верасня 2011 г.'); + test.done(); + }, + + testDateFmtShortTimeComponentsS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "s"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "37"); + test.done(); + }, + + testDateFmtShortTimeComponentsM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "m"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "45"); + test.done(); + }, + + testDateFmtShortTimeComponentsH_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "h"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13"); + test.done(); + }, + + testDateFmtShortTimeComponentsMS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "ms"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "45:37"); + test.done(); + }, + + testDateFmtShortTimeComponentsHM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "hm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "hms"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMA_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "hma"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + time: "hmz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45 MSK"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMAZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + time: "hmaz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45 MSK"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMSA_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", time: "hmsa"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMSZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + time: "hmsz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37 MSK"); + test.done(); + }, + + testDateFmtShortTimeComponentsHMSAZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + time: "hmsaz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37 MSK"); + test.done(); + }, + + testDateFmtFullTimeComponentsS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "s"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "37"); + test.done(); + }, + + testDateFmtFullTimeComponentsM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "m"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "45"); + test.done(); + }, + + testDateFmtFullTimeComponentsH_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "h"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13"); + test.done(); + }, + + testDateFmtFullTimeComponentsMS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "ms"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "45:37"); + test.done(); + }, + + testDateFmtFullTimeComponentsHM_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "hm"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMS_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "hms"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMA_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "hma"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + length: "full", + time: "hmz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45 MSK"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMAZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + length: "full", + time: "hmaz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45 MSK"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMSA_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", type: "time", length: "full", time: "hmsa"}); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMSZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + length: "full", + time: "hmsz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37 MSK"); + test.done(); + }, + + testDateFmtFullTimeComponentsHMSAZ_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + length: "full", + time: "hmsaz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37 MSK"); + test.done(); + }, + + testDateFmtWithTimeZoneAndNoDST_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({ + locale: "be-BY", + type: "time", + length: "full", + time: "hmsz", + timezone: "Europe/Moscow" + }); + test.ok(fmt !== null); + + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 12, + day: 29, + hour: 13, + minute: 45, + second: 37, + millisecond: 0 + }); + test.equal(fmt.format(date), "13:45:37 MSK"); + test.done(); + }, + + testDateFmtFormatRelativeWithinMinuteAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 30, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), "праз 30 секунд"); + test.done(); + }, +testDateFmtFormatRelativeWithinMinuteBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 44, + second: 30, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), "30 секунд таму"); + test.done(); + }, +testDateFmtFormatRelativeWithinHourAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), "праз 10 хвілін"); + test.done(); + }, +testDateFmtFormatRelativeWithinHourBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '10 хвілін таму'); + test.done(); + }, +testDateFmtFormatRelativeWithinDayAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 17, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), 'праз 4 гадзіны'); + test.done(); + }, +testDateFmtFormatRelativeWithinDayBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 9, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '4 гадзіны таму'); + test.done(); + }, + + testDateFmtFormatRelativeWithinFortnightAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 24, + hour: 15, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), 'праз 4 дні'); + test.done(); + }, +testDateFmtFormatRelativeWithinFortnightBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 16, + hour: 9, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '4 дні таму'); + test.done(); + }, + + testDateFmtFormatRelativeWithinQuarterAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 11, + day: 24, + hour: 15, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), 'праз 9 тыдняў'); + test.done(); + }, +testDateFmtFormatRelativeWithinQuarterBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 7, + day: 18, + hour: 9, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '9 тыдняў таму'); + test.done(); + }, + + testDateFmtFormatRelativeWithinTwoYearsAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2013, + month: 1, + day: 24, + hour: 15, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), 'праз 16 месяцаў'); + test.done(); + }, +testDateFmtFormatRelativeWithinTwoYearsBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2010, + month: 7, + day: 18, + hour: 9, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '14 месяцаў таму'); + test.done(); + }, + + testDateFmtFormatRelativeYearsAfter_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 2025, + month: 10, + day: 24, + hour: 15, + minute: 55, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), 'праз 14 гадоў'); + test.done(); + }, +testDateFmtFormatRelativeYearsBefore_be_BY: function(test) { + test.expect(2); + var fmt = new DateFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var reference = new GregorianDate({ + locale: "be-BY", + year: 2011, + month: 9, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var date = new GregorianDate({ + locale: "be-BY", + year: 1990, + month: 7, + day: 18, + hour: 9, + minute: 35, + second: 0, + millisecond: 0 + }); + test.equal(fmt.formatRelative(reference, date), '21 год таму'); + test.done(); + } +}; \ No newline at end of file diff --git a/js/test/date/testdatetimefmt.js b/js/test/date/testdatetimefmt.js index 2ad5c635b2..0d20d184fc 100644 --- a/js/test/date/testdatetimefmt.js +++ b/js/test/date/testdatetimefmt.js @@ -5128,6 +5128,32 @@ module.exports.testdatetimeformat = { result1 = new DateFmt({locale:"ka-GE", type:"time", time:"ahmsz", length:"full", useNative:false, timezone:"local"}).template; test.equal(result1, "HH:mm:ss z"); + test.done(); + }, + testDateTimeFormat_be_BY: function(test) { + test.expect(7); + + var result1, result2, result3, result4; + + result1 = new DateFmt({locale:"be-BY", type:"date", date:"dmwy", length: "full", useNative:false, timezone:"local"}).template; + result2 = new DateFmt({locale:"be-BY", type:"date", date:"dmwy", length: "long", useNative:false, timezone:"local"}).template; + result3 = new DateFmt({locale:"be-BY", type:"date", date:"dmwy", length: "medium", useNative:false, timezone:"local"}).template; + result4 = new DateFmt({locale:"be-BY", type:"date", date:"dmwy", length: "short", useNative:false, timezone:"local"}).template; + + test.equal(result1, "EEEE, d MMMM yyyy \'г\'."); + test.equal(result2, "EEE, d MMMM yyyy \'г\'."); + test.equal(result3, "EE, d.MM.yyyy"); + test.equal(result4, "E, d.MM.yy"); + + result1 = new DateFmt({locale:"be-BY", type:"datetime", date:"dmwy", length: "full", useNative:false, timezone:"local"}).template; + result2 = new DateFmt({locale:"be-BY", type:"datetime", date:"dmwy", length: "short", useNative:false, timezone:"local"}).template; + + test.equal(result1, "EEEE, d MMMM yyyy \'г\'. \'у\' HH:mm"); + test.equal(result2, "E, d.MM.yy, HH:mm"); + + result1 = new DateFmt({locale:"be-BY", type:"time", time:"ahmsz", length:"full", useNative:false, timezone:"local"}).template; + test.equal(result1, "HH:mm:ss z"); + test.done(); } } \ No newline at end of file diff --git a/js/test/daterange/testSuiteFiles.js b/js/test/daterange/testSuiteFiles.js index d79236ec11..f86795c407 100644 --- a/js/test/daterange/testSuiteFiles.js +++ b/js/test/daterange/testSuiteFiles.js @@ -26,6 +26,7 @@ module.exports.files = [ "testdatefmtrange_ar_SA.js", "testdatefmtrange_as_IN.js", "testdatefmtrange_az_Latn_AZ.js", + "testdatefmtrange_be_BY.js", "testdatefmtrange_bg_BG.js", "testdatefmtrange_bn_IN.js", "testdatefmtrange_bs_Latn_BA.js", diff --git a/js/test/daterange/testdatefmtrange_be_BY.js b/js/test/daterange/testdatefmtrange_be_BY.js new file mode 100644 index 0000000000..e3858558a1 --- /dev/null +++ b/js/test/daterange/testdatefmtrange_be_BY.js @@ -0,0 +1,692 @@ +/* + * testdatefmtrange_be_BY.js - test the date range formatter object Georgian/Georgia + * + * Copyright © 2020, JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +if (typeof(GregorianDate) === "undefined") { + var GregorianDate = require("../../lib/GregorianDate.js"); +} +if (typeof(DateRngFmt) === "undefined") { + var DateRngFmt = require("../../lib/DateRngFmt.js"); +} + +if (typeof(ilib) === "undefined") { + var ilib = require("../../lib/ilib.js"); +} + +module.exports.testdatefmtrange_be_BY = { + setUp: function(callback) { + ilib.clearCache(); + callback(); + }, + + testDateRngFmtkaGERangeInDayShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "31.12.11, 13:45 – 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeInDayMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "31.12.2011, 13:45 – 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeInDayLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "31 снежня 2011 г. у 13:45 – 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeInDayFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "31 снежня 2011 г. у 13:45 – 14:30"); + test.done(); + }, + + testDateRngFmtkaGERangeNextDayShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 30, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "30.12.11, 13:45 – 31.12.11, 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeNextDayMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 30, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "30.12.2011, 13:45 – 31.12.2011, 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeNextDayLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 30, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "30 снежня 2011 г. у 13:45 – 31 снежня 2011 г. у 14:30"); + test.done(); + }, + testDateRngFmtkaGERangeNextDayFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 30, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "30 снежня 2011 г. у 13:45 – 31 снежня 2011 г. у 14:30"); + test.done(); + }, + + testDateRngFmtkaGERangeMultiDayShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 – 31.12.11"); + test.done(); + }, + testDateRngFmtkaGERangeMultiDayMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 – 31.12.2011"); + test.done(); + }, + testDateRngFmtkaGERangeMultiDayLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 – 31 снежня 2011 г."); + test.done(); + }, + testDateRngFmtkaGERangeMultiDayFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 12, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 – 31 снежня 2011 г."); + test.done(); + }, + + testDateRngFmtkaGERangeNextMonthShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20.11 – 31.12.11"); + test.done(); + }, + testDateRngFmtkaGERangeNextMonthMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20.11 – 31.12.2011"); + test.done(); + }, + testDateRngFmtkaGERangeNextMonthLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 лістапада – 31 снежня 2011 г."); + test.done(); + }, + testDateRngFmtkaGERangeNextMonthFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2011, + month: 12, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 лістапада – 31 снежня 2011 г."); + test.done(); + }, + + testDateRngFmtkaGERangeNextYearShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2012, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20.11.11 – 31.01.12"); + test.done(); + }, + testDateRngFmtkaGERangeNextYearMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2012, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20.11.2011 – 31.01.2012"); + test.done(); + }, + testDateRngFmtkaGERangeNextYearLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2012, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 лістапада 2011 г. – 31 студзеня 2012 г."); + test.done(); + }, + testDateRngFmtkaGERangeNextYearFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2012, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "20 лістапада 2011 г. – 31 студзеня 2012 г."); + test.done(); + }, + + testDateRngFmtkaGERangeMultiYearShort: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2014, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "11.11 – 01.14"); + test.done(); + }, + testDateRngFmtkaGERangeMultiYearMedium: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2014, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "11.2011 – 01.2014"); + test.done(); + }, + testDateRngFmtkaGERangeMultiYearLong: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2014, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "лістапада 2011 г. – студзеня 2014 г."); + test.done(); + }, + testDateRngFmtkaGERangeMultiYearFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2014, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "лістапада 2011 г. – студзеня 2014 г."); + test.done(); + }, + testDateRngFmtkaGEManyYearsFull: function(test) { + test.expect(2); + var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); + test.ok(fmt !== null); + + var start = new GregorianDate({ + year: 2011, + month: 11, + day: 20, + hour: 13, + minute: 45, + second: 0, + millisecond: 0 + }); + var end = new GregorianDate({ + year: 2064, + month: 1, + day: 31, + hour: 14, + minute: 30, + second: 0, + millisecond: 0 + }); + test.equal(fmt.format(start, end), "2011 – 2064"); + test.done(); + } +}; \ No newline at end of file diff --git a/js/test/durfmt/testdurfmt2.js b/js/test/durfmt/testdurfmt2.js index 5d8c54d100..dece5ed04c 100644 --- a/js/test/durfmt/testdurfmt2.js +++ b/js/test/durfmt/testdurfmt2.js @@ -9035,6 +9035,59 @@ module.exports.testdurfmt2 = { test.equal(clockformatted_18[2], '18სთ, 18წთ, 18წმ'); test.equal(clockformatted_18[3], '18სთ, 18წთ, 18წმ'); + test.done(); + }, + testDurFmt_be_BY: function(test) { + test.expect(24); + // 1 3 100 + var textfmt; + var data = setVariable(); + var length = data["fullLength"]; + + var textformatted_1 = [], textformatted_3 = [], textformatted_100 = []; + var clockformatted_1 = [], clockformatted_3 = [], clockformatted_100 = []; + + for (var i=0; i<4; i++) { + textfmt = new DurationFmt({locale: "be-BY", style:"text", length:length[i]}); + textformatted_1.push(textfmt.format({year: 1,month: 1,week: 1,day: 1}).toString()); + textformatted_3.push(textfmt.format({year: 3,month: 3,week: 3,day: 3}).toString()); + textformatted_100.push(textfmt.format({year: 100,month: 100,week: 100,day: 100}).toString()); + + clockformatted_1.push(textfmt.format({hour: 1,minute: 1,second: 1}).toString()); + clockformatted_3.push(textfmt.format({hour: 3,minute: 3,second: 3}).toString()); + clockformatted_100.push(textfmt.format({hour: 100,minute: 100,second: 100}).toString()); + } + + test.equal(textformatted_1[0], '1 год 1 месяц 1 тыдзень 1 суткі'); + test.equal(textformatted_1[1], '1 г. 1 мес. 1 тыдз. 1 сут'); + test.equal(textformatted_1[2], '1 г. 1 мес. 1 тыдз. 1 сут'); + test.equal(textformatted_1[3], '1 г. 1 мес. 1 тыдз. 1 сут'); + + test.equal(textformatted_3[0], '3 гады 3 месяца 3 тыдні 3 сутак'); + test.equal(textformatted_3[1], '3 г. 3 мес. 3 тыдз. 3 сут'); + test.equal(textformatted_3[2], '3 г. 3 мес. 3 тыдз. 3 сут'); + test.equal(textformatted_3[3], '3 г. 3 мес. 3 тыдз. 3 сут'); + + test.equal(textformatted_100[0], '100 гадоў 100 месяцаў 100 тыдняў 100 сутак'); + test.equal(textformatted_100[1], '100 г. 100 мес. 100 тыдз. 100 сут'); + test.equal(textformatted_100[2], '100 г. 100 мес. 100 тыдз. 100 сут'); + test.equal(textformatted_100[3], '100 г. 100 мес. 100 тыдз. 100 сут'); + + test.equal(clockformatted_1[0], '1 гадзіна 1 хвіліна 1 секунда'); + test.equal(clockformatted_1[1], '1 гадз 1 хв 1 с'); + test.equal(clockformatted_1[2], '1 гадз 1 хв 1 с'); + test.equal(clockformatted_1[3], '1 гадз 1 хв 1 с'); + + test.equal(clockformatted_3[0], '3 гадзіны 3 хвіліны 3 секунды'); + test.equal(clockformatted_3[1], '3 гадз 3 хв 3 с'); + test.equal(clockformatted_3[2], '3 гадз 3 хв 3 с'); + test.equal(clockformatted_3[3], '3 гадз 3 хв 3 с'); + + test.equal(clockformatted_100[0], '100 гадзін 100 хвілін 100 секунд'); + test.equal(clockformatted_100[1], '100 гадз 100 хв 100 с'); + test.equal(clockformatted_100[2], '100 гадз 100 хв 100 с'); + test.equal(clockformatted_100[3], '100 гадз 100 хв 100 с'); + test.done(); } } diff --git a/js/test/number/testcurrency.js b/js/test/number/testcurrency.js index 4ebc9bedf3..f9e736488d 100644 --- a/js/test/number/testcurrency.js +++ b/js/test/number/testcurrency.js @@ -1902,6 +1902,15 @@ module.exports.testcurrency = { test.equal(info.getCurrency(), "GEL"); + test.done(); + }, + testCurrency_be_BY: function(test) { + test.expect(2); + var info = new LocaleInfo("be-BY"); + test.ok(info !== null); + + test.equal(info.getCurrency(), "BYN"); + test.done(); } }; diff --git a/js/test/number/testnumfmt2.js b/js/test/number/testnumfmt2.js index 845f03f896..86cfb57981 100644 --- a/js/test/number/testnumfmt2.js +++ b/js/test/number/testnumfmt2.js @@ -3773,5 +3773,24 @@ module.exports.testnumfmt2 = { test.equal(li.getCurrencyFormats().commonNegative, "-{n} {s}"); test.equal(curfmt.format(57.05), "57,05 ₾"); //GEL test.done(); + }, + testNumFmt_be_BY: function(test) { + test.expect(9); + var li = new LocaleInfo("be-BY"); + var fmt = new NumFmt({locale:"be-BY", type:"standard", useNative:false}); + test.equal(li.getDecimalSeparator(), ","); + test.equal(li.getGroupingSeparator(), " "); + test.equal(fmt.format(123456789.45), "123 456 789,45"); + + var pctfmt = new NumFmt({locale:"be-BY", type:"percentage", useNative:false}); + test.equal(li.getPercentageFormat(), "{n} %"); + test.equal(li.getNegativePercentageFormat(), "-{n} %"); + test.equal(pctfmt.format(34), "34 %"); + + var curfmt = new NumFmt({locale: "be-BY", type: "currency", useNative:false, currency:li.getCurrency()}); + test.equal(li.getCurrencyFormats().common, "{n} {s}"); + test.equal(li.getCurrencyFormats().commonNegative, "-{n} {s}"); + test.equal(curfmt.format(57.05), "57,05 р."); //BYN + test.done(); } } \ No newline at end of file diff --git a/js/test/root/testlocaleinfo.js b/js/test/root/testlocaleinfo.js index 9949aaee2f..282e824c93 100644 --- a/js/test/root/testlocaleinfo.js +++ b/js/test/root/testlocaleinfo.js @@ -13388,5 +13388,15 @@ module.exports.testlocaleinfo = { test.equal(info.getDelimiterQuotationEnd(), "“"); test.equal(info.getPaperSize(), "A4"); test.done(); + }, + testLocaleInfoQuotation_be_BY: function(test) { + test.expect(4); + var info = new LocaleInfo("be-BY"); + test.ok(info !== null); + + test.equal(info.getDelimiterQuotationStart(), "«"); + test.equal(info.getDelimiterQuotationEnd(), "»"); + test.equal(info.getPaperSize(), "A4"); + test.done(); } }; \ No newline at end of file diff --git a/js/test/root/testlocalematch.js b/js/test/root/testlocalematch.js index 850772fff3..e64964bcfe 100644 --- a/js/test/root/testlocalematch.js +++ b/js/test/root/testlocalematch.js @@ -1106,6 +1106,38 @@ module.exports.testlocalematch = { test.equal(locale.getSpec(), "ka-Geor-GE"); test.done(); }, + testLocaleMatcherGetLikelyLocaleByLocaleCode63: function(test) { + test.expect(3); + var lm = new LocaleMatcher({ + locale: "be-BY" + }); + test.ok(typeof(lm) !== "undefined"); + var locale = lm.getLikelyLocale(); + test.ok(typeof(locale) !== "undefined"); + test.equal(locale.getSpec(), "be-Cyrl-BY"); + test.done(); + }, + testLocaleMatcherGetLikelyLocaleByLocaleCode64: function(test) { + test.expect(3); + var lm = new LocaleMatcher({ + locale: "be" + }); + test.ok(typeof(lm) !== "undefined"); + var locale = lm.getLikelyLocale(); + test.ok(typeof(locale) !== "undefined"); + test.equal(locale.getSpec(), "be-Cyrl-BY"); + test.done(); + },testLocaleMatcherGetLikelyLocaleByLocaleCode65: function(test) { + test.expect(3); + var lm = new LocaleMatcher({ + locale: "BY" + }); + test.ok(typeof(lm) !== "undefined"); + var locale = lm.getLikelyLocale(); + test.ok(typeof(locale) !== "undefined"); + test.equal(locale.getSpec(), "be-Cyrl-BY"); + test.done(); + }, testLocaleMatcherMatchExactFullLocale: function(test) { test.expect(2); @@ -1573,6 +1605,17 @@ module.exports.testlocalematch = { test.equal(locale.getSpec(), "ka-GE"); test.done(); }, + testLocaleMatcherGetLikelyLocaleMinimalByLanguage4: function(test) { + test.expect(3); + var lm = new LocaleMatcher({ + locale: "be" + }); + test.ok(typeof(lm) !== "undefined"); + var locale = lm.getLikelyLocaleMinimal(); + test.ok(typeof(locale) !== "undefined"); + test.equal(locale.getSpec(), "be-BY"); + test.done(); + }, testLocaleMatcherGetLikelyLocaleMinimalUzbek: function(test) { test.expect(3); diff --git a/js/test/root/testscriptinfo.js b/js/test/root/testscriptinfo.js index c686e0409e..08f4f29c5b 100644 --- a/js/test/root/testscriptinfo.js +++ b/js/test/root/testscriptinfo.js @@ -2185,5 +2185,15 @@ module.exports.testscriptinfo = { test.equal(li.getScript(), "Geor"); test.equal(scinfo.getScriptDirection(), "ltr"); test.done(); + }, + testScriptInfo_be_BY: function(test) { + test.expect(4); + var li = new LocaleInfo("be-BY"); + var scinfo = new ScriptInfo(li.getScript()); + test.ok(li !== null); + test.ok(scinfo !== null); + test.equal(li.getScript(), "Cyrl"); + test.equal(scinfo.getScriptDirection(), "ltr"); + test.done(); } }; diff --git a/js/test/root/teststrings.js b/js/test/root/teststrings.js index 57a8473b46..e4bbc51461 100644 --- a/js/test/root/teststrings.js +++ b/js/test/root/teststrings.js @@ -3263,6 +3263,46 @@ module.exports.teststrings = { test.equal(str.formatChoice(1), "There items are one"); test.done(); }, + testStringFormatChoiceCharClasses25: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(0), "There are no items."); + test.done(); + }, + testStringFormatChoiceCharClasses26: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(1), "There items are one"); + test.done(); + }, + testStringFormatChoiceCharClasses27: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(3), "The items are few"); + test.done(); + }, + testStringFormatChoiceCharClasses28: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(100), "The items are many"); + test.done(); + }, testStringFormatChoiceCharClassesComplex1: function(test) { test.expect(2); @@ -3670,5 +3710,35 @@ module.exports.teststrings = { test.equal(str.formatChoice(1.7), "Default items"); test.done(); + }, + testStringFormatChoiceDecimal26: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(21.0), "There items are one"); + test.done(); + }, + testStringFormatChoiceDecimal27: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(33.0), "The items are few"); + test.done(); + }, + testStringFormatChoiceDecimal28: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(100.1), "Default items"); + test.done(); } }; \ No newline at end of file diff --git a/js/test/strings-ext/testSuiteFiles.js b/js/test/strings-ext/testSuiteFiles.js index b290555e25..0ea3ee78d1 100644 --- a/js/test/strings-ext/testSuiteFiles.js +++ b/js/test/strings-ext/testSuiteFiles.js @@ -23,6 +23,7 @@ module.exports.files = [ "testlistfmt.js", "testlistfmt_am_ET.js", "testlistfmt_ar.js", + "testlistfmt_be_BY.js", "testlistfmt_bs.js", "testlistfmt_de.js", "testlistfmt_el.js", diff --git a/js/test/strings-ext/testlistfmt_be_BY.js b/js/test/strings-ext/testlistfmt_be_BY.js new file mode 100644 index 0000000000..43fc7fa0a6 --- /dev/null +++ b/js/test/strings-ext/testlistfmt_be_BY.js @@ -0,0 +1,253 @@ +/* + * testlistfmt_be_BY.js - test the list formatter object + * + * Copyright © 2020, JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSe-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +if (typeof(ListFmt) === "undefined") { + var ListFmt = require("../../lib/ListFmt.js"); +} + +if (typeof(ilib) === "undefined") { + var ilib = require("../../lib/ilib.js"); +} + +module.exports.testlistfmt_be_BY = { + setUp: function(callback) { + ilib.clearCache(); + callback(); + }, + testListFmtkaGENumberFormatOne: function(test) { + var fmt = new ListFmt({ + locale: "be-BY" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін"]), "адзін"); + test.done(); + }, + testListFmtkaGENumberFormatTwo: function(test) { + var fmt = new ListFmt({ + locale: "be-BY" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два"]), "адзін і два"); + test.done(); + }, + testListFmtkaGENumberFormatThree: function(test) { + var fmt = new ListFmt({ + locale: "be-BY" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры"]), "адзін, два і тры"); + test.done(); + }, + testListFmtkaGENumberFormatFour: function(test) { + var fmt = new ListFmt({ + locale: "be-BY" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін, два, тры і чатыры"); + test.done(); + }, + testListFmtkaGENumberFormatFive: function(test) { + var fmt = new ListFmt({ + locale: "be-BY" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін, два, тры, чатыры і ხუთი"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatOneShort: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін"]), "адзін"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatTwoShort: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два"]), "адзін два"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatThreeShort: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры"]), "адзін два тры"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatFourShort: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін два тры чатыры"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatFiveShort: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін два тры чатыры ხუთი"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatOneFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit", + length: "full" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін"]), "адзін"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatTwoFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit", + length: "full" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два"]), "адзін два"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatThreeFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit", + length: "full" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры"]), "адзін два тры"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatFourFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit", + length: "full" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін два тры чатыры"); + test.done(); + }, + testListFmtUnitStylekaGENumberFormatFiveFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "unit", + length: "full" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін два тры чатыры ხუთი"); + test.done(); + }, + testListFmtORStylekaGENumberFormatOne: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "disjunction" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін"]), "адзін"); + test.done(); + }, + testListFmtORStylekaGENumberFormatTwo: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "disjunction" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два"]), "адзін ці два"); + test.done(); + }, + testListFmtORStylekaGENumberFormatThree: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "disjunction" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры"]), "адзін, два ці тры"); + test.done(); + }, + testListFmtORStylekaGENumberFormatFour: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "disjunction" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін, два, тры ці чатыры"); + test.done(); + }, + testListFmtORStylekaGENumberFormatFiveFull: function(test) { + var fmt = new ListFmt({ + locale: "be-BY", + style: "disjunction" + }); + + test.expect(2); + test.ok(fmt !== null); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін, два, тры, чатыры ці ხუთი"); + test.done(); + } +}; \ No newline at end of file diff --git a/js/test/units/testmeasurement.js b/js/test/units/testmeasurement.js index 5480878c96..f5aa03cb8d 100644 --- a/js/test/units/testmeasurement.js +++ b/js/test/units/testmeasurement.js @@ -715,6 +715,12 @@ module.exports.testmeasurement = { test.equal(Measurement.getMeasurementSystemForLocale("zu-ZA"), "metric"); test.done(); }, + testMeasurementGetMeasurementSystemOther4: function(test) { + test.expect(1); + + test.equal(Measurement.getMeasurementSystemForLocale("be-BY"), "metric"); + test.done(); + }, testMeasurementGetMeasurementSystemOtherWithLocaleObj: function(test) { test.expect(1); diff --git a/js/test/units/testunitfmt.js b/js/test/units/testunitfmt.js index 9905fb5758..37db9b1d41 100644 --- a/js/test/units/testunitfmt.js +++ b/js/test/units/testunitfmt.js @@ -1936,6 +1936,30 @@ module.exports.testunitfmt = { test.equal(str, "1,000兆字节/秒"); test.done(); }, + testUnitFormatDigitalSpeed5: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "megabyte/s", + amount: 1000 + }); + + var uf = new UnitFmt({locale: "be-BY",length:"long",autoConvert:false,autoScale: false}); + var str = uf.format(m1); + test.equal(str, "1 000 мегабайта у секунду"); + test.done(); + }, + testUnitFormatDigitalSpeed6: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "megabyte/s", + amount: 1000 + }); + + var uf = new UnitFmt({locale: "be-BY",length:"short",autoConvert:false,autoScale: false}); + var str = uf.format(m1); + test.equal(str, "1 000 МБ/с"); + test.done(); + }, testUnitFormatEnergy11: function(test) { test.expect(1); From f0af18afaa79091d5e9adb791567795168cbc94e Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Wed, 19 Aug 2020 09:23:18 +0900 Subject: [PATCH 2/8] More updates. apply feedback --- js/test/date/testdatefmt_be_BY.js | 38 ++++++++++----------- js/test/daterange/testdatefmtrange_be_BY.js | 2 +- js/test/root/teststrings.js | 10 ++++++ js/test/strings-ext/testlistfmt_be_BY.js | 8 ++--- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/js/test/date/testdatefmt_be_BY.js b/js/test/date/testdatefmt_be_BY.js index 5b1d84c21c..b85b836d6e 100644 --- a/js/test/date/testdatefmt_be_BY.js +++ b/js/test/date/testdatefmt_be_BY.js @@ -1,5 +1,5 @@ /* - * testdatefmt_be_BY.js - test the date formatter object in Georgian + * testdatefmt_be_BY.js - test the date formatter object in Belarus * * Copyright © 2020, JEDLSoft * @@ -1003,7 +1003,7 @@ module.exports.testdatefmt_be_BY = { locale: "be-BY", type: "time", time: "hmz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1017,7 +1017,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45 MSK"); + test.equal(fmt.format(date), "13:45 +03"); test.done(); }, @@ -1027,7 +1027,7 @@ module.exports.testdatefmt_be_BY = { locale: "be-BY", type: "time", time: "hmaz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1041,7 +1041,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45 MSK"); + test.equal(fmt.format(date), "13:45 +03"); test.done(); }, @@ -1070,7 +1070,7 @@ module.exports.testdatefmt_be_BY = { locale: "be-BY", type: "time", time: "hmsz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1084,7 +1084,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45:37 MSK"); + test.equal(fmt.format(date), "13:45:37 +03"); test.done(); }, @@ -1094,7 +1094,7 @@ module.exports.testdatefmt_be_BY = { locale: "be-BY", type: "time", time: "hmsaz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1108,7 +1108,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45:37 MSK"); + test.equal(fmt.format(date), "13:45:37 +03"); test.done(); }, @@ -1252,7 +1252,7 @@ module.exports.testdatefmt_be_BY = { type: "time", length: "full", time: "hmz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1266,7 +1266,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45 MSK"); + test.equal(fmt.format(date), "13:45 +03"); test.done(); }, @@ -1277,7 +1277,7 @@ module.exports.testdatefmt_be_BY = { type: "time", length: "full", time: "hmaz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1291,7 +1291,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45 MSK"); + test.equal(fmt.format(date), "13:45 +03"); test.done(); }, @@ -1321,7 +1321,7 @@ module.exports.testdatefmt_be_BY = { type: "time", length: "full", time: "hmsz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1335,7 +1335,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45:37 MSK"); + test.equal(fmt.format(date), "13:45:37 +03"); test.done(); }, @@ -1346,7 +1346,7 @@ module.exports.testdatefmt_be_BY = { type: "time", length: "full", time: "hmsaz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1360,7 +1360,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45:37 MSK"); + test.equal(fmt.format(date), "13:45:37 +03"); test.done(); }, @@ -1371,7 +1371,7 @@ module.exports.testdatefmt_be_BY = { type: "time", length: "full", time: "hmsz", - timezone: "Europe/Moscow" + timezone: "Europe/Minsk" }); test.ok(fmt !== null); @@ -1385,7 +1385,7 @@ module.exports.testdatefmt_be_BY = { second: 37, millisecond: 0 }); - test.equal(fmt.format(date), "13:45:37 MSK"); + test.equal(fmt.format(date), "13:45:37 +03"); test.done(); }, diff --git a/js/test/daterange/testdatefmtrange_be_BY.js b/js/test/daterange/testdatefmtrange_be_BY.js index e3858558a1..a0b9463b7c 100644 --- a/js/test/daterange/testdatefmtrange_be_BY.js +++ b/js/test/daterange/testdatefmtrange_be_BY.js @@ -1,5 +1,5 @@ /* - * testdatefmtrange_be_BY.js - test the date range formatter object Georgian/Georgia + * testdatefmtrange_be_BY.js - test the date range formatter object Belarussian/Belarus * * Copyright © 2020, JEDLSoft * diff --git a/js/test/root/teststrings.js b/js/test/root/teststrings.js index e4bbc51461..32fd9f0b01 100644 --- a/js/test/root/teststrings.js +++ b/js/test/root/teststrings.js @@ -3303,6 +3303,16 @@ module.exports.teststrings = { test.equal(str.formatChoice(100), "The items are many"); test.done(); }, + testStringFormatChoiceCharClasses29: function(test) { + test.expect(2); + var str = new IString("0#There are no items.|one#There items are one|few#The items are few|many#The items are many|#Default items"); + str.setLocale("be-BY"); + + test.ok(str !== null); + + test.equal(str.formatChoice(8), "The items are many"); + test.done(); + }, testStringFormatChoiceCharClassesComplex1: function(test) { test.expect(2); diff --git a/js/test/strings-ext/testlistfmt_be_BY.js b/js/test/strings-ext/testlistfmt_be_BY.js index 43fc7fa0a6..15d82ad146 100644 --- a/js/test/strings-ext/testlistfmt_be_BY.js +++ b/js/test/strings-ext/testlistfmt_be_BY.js @@ -77,7 +77,7 @@ module.exports.testlistfmt_be_BY = { test.expect(2); test.ok(fmt !== null); - test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін, два, тры, чатыры і ხუთი"); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін, два, тры, чатыры і пяць"); test.done(); }, testListFmtUnitStylekaGENumberFormatOneShort: function(test) { @@ -132,7 +132,7 @@ module.exports.testlistfmt_be_BY = { test.expect(2); test.ok(fmt !== null); - test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін два тры чатыры ხუთი"); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін два тры чатыры пяць"); test.done(); }, testListFmtUnitStylekaGENumberFormatOneFull: function(test) { @@ -192,7 +192,7 @@ module.exports.testlistfmt_be_BY = { test.expect(2); test.ok(fmt !== null); - test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін два тры чатыры ხუთი"); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін два тры чатыры пяць"); test.done(); }, testListFmtORStylekaGENumberFormatOne: function(test) { @@ -247,7 +247,7 @@ module.exports.testlistfmt_be_BY = { test.expect(2); test.ok(fmt !== null); - test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "ხუთი"]), "адзін, два, тры, чатыры ці ხუთი"); + test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін, два, тры, чатыры ці пяць"); test.done(); } }; \ No newline at end of file From 52b0ac5a86fd7daab83854ba3a2263b944186179 Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Wed, 19 Aug 2020 15:15:09 +0900 Subject: [PATCH 3/8] Add dayofWeek test case for be-BY --- js/test/date/testDayOfWeek.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/test/date/testDayOfWeek.js b/js/test/date/testDayOfWeek.js index 0aa7c5b75a..c042b31bf4 100644 --- a/js/test/date/testDayOfWeek.js +++ b/js/test/date/testDayOfWeek.js @@ -1964,6 +1964,16 @@ module.exports.testweekdata = { var info = new LocaleInfo("ka-GE"); test.ok(info !== null); + test.equal(info.getFirstDayOfWeek(), 1); + test.equal(info.getWeekEndStart(), 6); + test.equal(info.getWeekEndEnd(), 0); + test.done(); + }, + testWeekData_be_BY: function(test) { + test.expect(4); + var info = new LocaleInfo("be-BY"); + test.ok(info !== null); + test.equal(info.getFirstDayOfWeek(), 1); test.equal(info.getWeekEndStart(), 6); test.equal(info.getWeekEndEnd(), 0); From 32d8290910e46dd8642d436acda4c4d4d7a34adb Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Wed, 19 Aug 2020 15:45:35 +0900 Subject: [PATCH 4/8] Add one more missing test case which is daterange template --- .../daterange/testdatefmtrange_fmttemplate.js | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/js/test/daterange/testdatefmtrange_fmttemplate.js b/js/test/daterange/testdatefmtrange_fmttemplate.js index 05cf803d08..0ef2975a9b 100644 --- a/js/test/daterange/testdatefmtrange_fmttemplate.js +++ b/js/test/daterange/testdatefmtrange_fmttemplate.js @@ -13864,6 +13864,78 @@ module.exports.testdaterangefmt = { test.equal(templatec30[2], "{sy} – {ey}"); test.equal(templatec30[3], "{sy} – {ey}"); + test.done(); + }, + testDateRngFmt_be_BY: function(test) { + test.expect(36); + var fmt; + var data = setVariables(); + var length = data["fullLength"]; + var abbrLength = data["abbrLength"]; + + var templatec00 = [],templatec01 = [],templatec02 = [],templatec03 = []; + var templatec10 = [],templatec11 = [],templatec12 = [],templatec20 = []; + var templatec30 = []; + + //dmy + for (var i=0; i < 4; i++) { + fmt = new DateRngFmt({locale:"be-BY", length: length[i]}) + templatec00.push(fmt.dateFmt.formats.range["c00"][abbrLength[i]]); + templatec01.push(fmt.dateFmt.formats.range["c01"][abbrLength[i]]); + templatec02.push(fmt.dateFmt.formats.range["c02"][abbrLength[i]]); + templatec03.push(fmt.dateFmt.formats.range["c03"][abbrLength[i]]); + templatec10.push(fmt.dateFmt.formats.range["c10"][abbrLength[i]]); + templatec11.push(fmt.dateFmt.formats.range["c11"][abbrLength[i]]); + templatec12.push(fmt.dateFmt.formats.range["c12"][abbrLength[i]]); + templatec20.push(fmt.dateFmt.formats.range["c20"][abbrLength[i]]); + templatec30.push(fmt.dateFmt.formats.range["c30"][abbrLength[i]]); + } + + test.equal(templatec00[0], '{sd} {sm} {sy} г. у {st} – {et}'); + test.equal(templatec00[1], '{sd} {sm} {sy} г. у {st} – {et}'); + test.equal(templatec00[2], '{sd}.{sm}.{sy}, {st} – {et}'); + test.equal(templatec00[3], '{sd}.{sm}.{sy}, {st} – {et}'); + + test.equal(templatec01[0], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec01[1], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec01[2], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + test.equal(templatec01[3], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + + test.equal(templatec02[1], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec02[0], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec02[2], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + test.equal(templatec02[3], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + + test.equal(templatec03[0], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec03[1], '{sd} {sm} {sy} г. у {st} – {ed} {em} {ey} г. у {et}'); + test.equal(templatec03[2], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + test.equal(templatec03[3], '{sd}.{sm}.{sy}, {st} – {ed}.{em}.{ey}, {et}'); + + test.equal(templatec10[0], '{sd} – {ed} {em} {ey} г.'); + test.equal(templatec10[1], '{sd} – {ed} {em} {ey} г.'); + test.equal(templatec10[2], '{sd} – {ed}.{em}.{ey}'); + test.equal(templatec10[3], '{sd} – {ed}.{em}.{ey}'); + + test.equal(templatec11[0], '{sd} {sm} – {ed} {em} {ey} г.'); + test.equal(templatec11[1], '{sd} {sm} – {ed} {em} {ey} г.'); + test.equal(templatec11[2], '{sd}.{sm} – {ed}.{em}.{ey}'); + test.equal(templatec11[3], '{sd}.{sm} – {ed}.{em}.{ey}'); + + test.equal(templatec12[0], '{sd} {sm} {sy} г. – {ed} {em} {ey} г.'); + test.equal(templatec12[1], '{sd} {sm} {sy} г. – {ed} {em} {ey} г.'); + test.equal(templatec12[2], '{sd}.{sm}.{sy} – {ed}.{em}.{ey}'); + test.equal(templatec12[3], '{sd}.{sm}.{sy} – {ed}.{em}.{ey}'); + + test.equal(templatec20[0], '{sm} {sy} г. – {em} {ey} г.'); + test.equal(templatec20[1], '{sm} {sy} г. – {em} {ey} г.'); + test.equal(templatec20[2], '{sm}.{sy} – {em}.{ey}'); + test.equal(templatec20[3], '{sm}.{sy} – {em}.{ey}'); + + test.equal(templatec30[0], "{sy} – {ey}"); + test.equal(templatec30[1], "{sy} – {ey}"); + test.equal(templatec30[2], "{sy} – {ey}"); + test.equal(templatec30[3], "{sy} – {ey}"); + test.done(); } } \ No newline at end of file From d4a99c742309852399265f186f88f5d44ed349f3 Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Wed, 19 Aug 2020 16:04:08 +0900 Subject: [PATCH 5/8] Fixed wrong test function name --- js/test/daterange/testdatefmtrange_be_BY.js | 50 ++++++++++----------- js/test/root/testcountry.js | 13 ++++++ js/test/strings-ext/testlistfmt_be_BY.js | 40 ++++++++--------- 3 files changed, 58 insertions(+), 45 deletions(-) diff --git a/js/test/daterange/testdatefmtrange_be_BY.js b/js/test/daterange/testdatefmtrange_be_BY.js index a0b9463b7c..53704e2832 100644 --- a/js/test/daterange/testdatefmtrange_be_BY.js +++ b/js/test/daterange/testdatefmtrange_be_BY.js @@ -34,7 +34,7 @@ module.exports.testdatefmtrange_be_BY = { callback(); }, - testDateRngFmtkaGERangeInDayShort: function(test) { + testDateRngFmtbeBYRangeInDayShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -60,7 +60,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "31.12.11, 13:45 – 14:30"); test.done(); }, - testDateRngFmtkaGERangeInDayMedium: function(test) { + testDateRngFmtbeBYRangeInDayMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -86,7 +86,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "31.12.2011, 13:45 – 14:30"); test.done(); }, - testDateRngFmtkaGERangeInDayLong: function(test) { + testDateRngFmtbeBYRangeInDayLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -112,7 +112,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "31 снежня 2011 г. у 13:45 – 14:30"); test.done(); }, - testDateRngFmtkaGERangeInDayFull: function(test) { + testDateRngFmtbeBYRangeInDayFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -139,7 +139,7 @@ module.exports.testdatefmtrange_be_BY = { test.done(); }, - testDateRngFmtkaGERangeNextDayShort: function(test) { + testDateRngFmtbeBYRangeNextDayShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -165,7 +165,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "30.12.11, 13:45 – 31.12.11, 14:30"); test.done(); }, - testDateRngFmtkaGERangeNextDayMedium: function(test) { + testDateRngFmtbeBYRangeNextDayMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -191,7 +191,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "30.12.2011, 13:45 – 31.12.2011, 14:30"); test.done(); }, - testDateRngFmtkaGERangeNextDayLong: function(test) { + testDateRngFmtbeBYRangeNextDayLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -217,7 +217,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "30 снежня 2011 г. у 13:45 – 31 снежня 2011 г. у 14:30"); test.done(); }, - testDateRngFmtkaGERangeNextDayFull: function(test) { + testDateRngFmtbeBYRangeNextDayFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -244,7 +244,7 @@ module.exports.testdatefmtrange_be_BY = { test.done(); }, - testDateRngFmtkaGERangeMultiDayShort: function(test) { + testDateRngFmtbeBYRangeMultiDayShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -270,7 +270,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20 – 31.12.11"); test.done(); }, - testDateRngFmtkaGERangeMultiDayMedium: function(test) { + testDateRngFmtbeBYRangeMultiDayMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -296,7 +296,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20 – 31.12.2011"); test.done(); }, - testDateRngFmtkaGERangeMultiDayLong: function(test) { + testDateRngFmtbeBYRangeMultiDayLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -322,7 +322,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20 – 31 снежня 2011 г."); test.done(); }, - testDateRngFmtkaGERangeMultiDayFull: function(test) { + testDateRngFmtbeBYRangeMultiDayFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -349,7 +349,7 @@ module.exports.testdatefmtrange_be_BY = { test.done(); }, - testDateRngFmtkaGERangeNextMonthShort: function(test) { + testDateRngFmtbeBYRangeNextMonthShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -375,7 +375,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20.11 – 31.12.11"); test.done(); }, - testDateRngFmtkaGERangeNextMonthMedium: function(test) { + testDateRngFmtbeBYRangeNextMonthMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -401,7 +401,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20.11 – 31.12.2011"); test.done(); }, - testDateRngFmtkaGERangeNextMonthLong: function(test) { + testDateRngFmtbeBYRangeNextMonthLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -427,7 +427,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20 лістапада – 31 снежня 2011 г."); test.done(); }, - testDateRngFmtkaGERangeNextMonthFull: function(test) { + testDateRngFmtbeBYRangeNextMonthFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -454,7 +454,7 @@ module.exports.testdatefmtrange_be_BY = { test.done(); }, - testDateRngFmtkaGERangeNextYearShort: function(test) { + testDateRngFmtbeBYRangeNextYearShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -480,7 +480,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20.11.11 – 31.01.12"); test.done(); }, - testDateRngFmtkaGERangeNextYearMedium: function(test) { + testDateRngFmtbeBYRangeNextYearMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -506,7 +506,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20.11.2011 – 31.01.2012"); test.done(); }, - testDateRngFmtkaGERangeNextYearLong: function(test) { + testDateRngFmtbeBYRangeNextYearLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -532,7 +532,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "20 лістапада 2011 г. – 31 студзеня 2012 г."); test.done(); }, - testDateRngFmtkaGERangeNextYearFull: function(test) { + testDateRngFmtbeBYRangeNextYearFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -559,7 +559,7 @@ module.exports.testdatefmtrange_be_BY = { test.done(); }, - testDateRngFmtkaGERangeMultiYearShort: function(test) { + testDateRngFmtbeBYRangeMultiYearShort: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "short"}); test.ok(fmt !== null); @@ -585,7 +585,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "11.11 – 01.14"); test.done(); }, - testDateRngFmtkaGERangeMultiYearMedium: function(test) { + testDateRngFmtbeBYRangeMultiYearMedium: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "medium"}); test.ok(fmt !== null); @@ -611,7 +611,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "11.2011 – 01.2014"); test.done(); }, - testDateRngFmtkaGERangeMultiYearLong: function(test) { + testDateRngFmtbeBYRangeMultiYearLong: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "long"}); test.ok(fmt !== null); @@ -637,7 +637,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "лістапада 2011 г. – студзеня 2014 г."); test.done(); }, - testDateRngFmtkaGERangeMultiYearFull: function(test) { + testDateRngFmtbeBYRangeMultiYearFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); @@ -663,7 +663,7 @@ module.exports.testdatefmtrange_be_BY = { test.equal(fmt.format(start, end), "лістапада 2011 г. – студзеня 2014 г."); test.done(); }, - testDateRngFmtkaGEManyYearsFull: function(test) { + testDateRngFmtbeBYManyYearsFull: function(test) { test.expect(2); var fmt = new DateRngFmt({locale: "be-BY", length: "full"}); test.ok(fmt !== null); diff --git a/js/test/root/testcountry.js b/js/test/root/testcountry.js index f059070888..bf6394fe16 100644 --- a/js/test/root/testcountry.js +++ b/js/test/root/testcountry.js @@ -172,6 +172,19 @@ module.exports.testcountry = { test.equal(locale.toString(), "en-AU"); test.done(); }, + testCountryLocale9: function(test) { + test.expect(4); + var ctry = new Country({ + locale: "be-BY" + }); + test.ok(ctry !== null); + + test.equal(ctry.getName("MO"),"Макаа, САР (Кітай)" ); + test.equal(ctry.getCode("Макаа, САР (Кітай)"), "MO"); + var locale = ctry.getLocale(); + test.equal(locale.toString(), "be-BY"); + test.done(); + }, testCountryGetByCodeUnknown: function(test) { try { diff --git a/js/test/strings-ext/testlistfmt_be_BY.js b/js/test/strings-ext/testlistfmt_be_BY.js index 15d82ad146..b2469dc1aa 100644 --- a/js/test/strings-ext/testlistfmt_be_BY.js +++ b/js/test/strings-ext/testlistfmt_be_BY.js @@ -30,7 +30,7 @@ module.exports.testlistfmt_be_BY = { ilib.clearCache(); callback(); }, - testListFmtkaGENumberFormatOne: function(test) { + testListFmtbeBYNumberFormatOne: function(test) { var fmt = new ListFmt({ locale: "be-BY" }); @@ -40,7 +40,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін"]), "адзін"); test.done(); }, - testListFmtkaGENumberFormatTwo: function(test) { + testListFmtbeBYNumberFormatTwo: function(test) { var fmt = new ListFmt({ locale: "be-BY" }); @@ -50,7 +50,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два"]), "адзін і два"); test.done(); }, - testListFmtkaGENumberFormatThree: function(test) { + testListFmtbeBYNumberFormatThree: function(test) { var fmt = new ListFmt({ locale: "be-BY" }); @@ -60,7 +60,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры"]), "адзін, два і тры"); test.done(); }, - testListFmtkaGENumberFormatFour: function(test) { + testListFmtbeBYNumberFormatFour: function(test) { var fmt = new ListFmt({ locale: "be-BY" }); @@ -70,7 +70,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін, два, тры і чатыры"); test.done(); }, - testListFmtkaGENumberFormatFive: function(test) { + testListFmtbeBYNumberFormatFive: function(test) { var fmt = new ListFmt({ locale: "be-BY" }); @@ -80,7 +80,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін, два, тры, чатыры і пяць"); test.done(); }, - testListFmtUnitStylekaGENumberFormatOneShort: function(test) { + testListFmtUnitStylebeBYNumberFormatOneShort: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit" @@ -91,7 +91,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін"]), "адзін"); test.done(); }, - testListFmtUnitStylekaGENumberFormatTwoShort: function(test) { + testListFmtUnitStylebeBYNumberFormatTwoShort: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit" @@ -102,7 +102,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два"]), "адзін два"); test.done(); }, - testListFmtUnitStylekaGENumberFormatThreeShort: function(test) { + testListFmtUnitStylebeBYNumberFormatThreeShort: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit" @@ -113,7 +113,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры"]), "адзін два тры"); test.done(); }, - testListFmtUnitStylekaGENumberFormatFourShort: function(test) { + testListFmtUnitStylebeBYNumberFormatFourShort: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit" @@ -124,7 +124,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін два тры чатыры"); test.done(); }, - testListFmtUnitStylekaGENumberFormatFiveShort: function(test) { + testListFmtUnitStylebeBYNumberFormatFiveShort: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit" @@ -135,7 +135,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін два тры чатыры пяць"); test.done(); }, - testListFmtUnitStylekaGENumberFormatOneFull: function(test) { + testListFmtUnitStylebeBYNumberFormatOneFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit", @@ -147,7 +147,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін"]), "адзін"); test.done(); }, - testListFmtUnitStylekaGENumberFormatTwoFull: function(test) { + testListFmtUnitStylebeBYNumberFormatTwoFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit", @@ -159,7 +159,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два"]), "адзін два"); test.done(); }, - testListFmtUnitStylekaGENumberFormatThreeFull: function(test) { + testListFmtUnitStylebeBYNumberFormatThreeFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit", @@ -171,7 +171,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры"]), "адзін два тры"); test.done(); }, - testListFmtUnitStylekaGENumberFormatFourFull: function(test) { + testListFmtUnitStylebeBYNumberFormatFourFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit", @@ -183,7 +183,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін два тры чатыры"); test.done(); }, - testListFmtUnitStylekaGENumberFormatFiveFull: function(test) { + testListFmtUnitStylebeBYNumberFormatFiveFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "unit", @@ -195,7 +195,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры", "пяць"]), "адзін два тры чатыры пяць"); test.done(); }, - testListFmtORStylekaGENumberFormatOne: function(test) { + testListFmtORStylebeBYNumberFormatOne: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "disjunction" @@ -206,7 +206,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін"]), "адзін"); test.done(); }, - testListFmtORStylekaGENumberFormatTwo: function(test) { + testListFmtORStylebeBYNumberFormatTwo: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "disjunction" @@ -217,7 +217,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два"]), "адзін ці два"); test.done(); }, - testListFmtORStylekaGENumberFormatThree: function(test) { + testListFmtORStylebeBYNumberFormatThree: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "disjunction" @@ -228,7 +228,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры"]), "адзін, два ці тры"); test.done(); }, - testListFmtORStylekaGENumberFormatFour: function(test) { + testListFmtORStylebeBYNumberFormatFour: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "disjunction" @@ -239,7 +239,7 @@ module.exports.testlistfmt_be_BY = { test.equal(fmt.format(["адзін", "два", "тры", "чатыры"]), "адзін, два, тры ці чатыры"); test.done(); }, - testListFmtORStylekaGENumberFormatFiveFull: function(test) { + testListFmtORStylebeBYNumberFormatFiveFull: function(test) { var fmt = new ListFmt({ locale: "be-BY", style: "disjunction" From 5740a57e9fafea6d78f2a0a61d8c9fbf7f31325e Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Wed, 19 Aug 2020 18:33:00 +0900 Subject: [PATCH 6/8] Add new testunifmt_be_BY.js file to check the locales's default value. --- js/test/units/testSuiteFiles.js | 1 + js/test/units/testunitfmt_be_BY.js | 330 +++++++++++++++++++++++++++++ 2 files changed, 331 insertions(+) create mode 100644 js/test/units/testunitfmt_be_BY.js diff --git a/js/test/units/testSuiteFiles.js b/js/test/units/testSuiteFiles.js index 152892446b..e1c065731c 100644 --- a/js/test/units/testSuiteFiles.js +++ b/js/test/units/testSuiteFiles.js @@ -31,6 +31,7 @@ module.exports.files = [ "testtemp.js", "testtime.js", "testunitfmt.js", + "testunitfmt_be_BY.js", "testunits.js", "testunitfmtasync.js", "testdigitalspeed.js", diff --git a/js/test/units/testunitfmt_be_BY.js b/js/test/units/testunitfmt_be_BY.js new file mode 100644 index 0000000000..d4cd4660e9 --- /dev/null +++ b/js/test/units/testunitfmt_be_BY.js @@ -0,0 +1,330 @@ +/* + * testunitfmt_be_BY.js - test the unitfmt for be-BY + * + * Copyright © 2020 JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +if (typeof(UnitFmt) === "undefined") { + var UnitFmt = require("../../lib/UnitFmt.js"); +} +if (typeof(Measurement) === "undefined") { + var Measurement = require("../../lib/Measurement.js"); +} + +if (typeof(MeasurementFactory) === "undefined") { + var MeasurementFactory = require("../../lib/MeasurementFactory.js"); +} + +if (typeof(ilib) === "undefined") { + var ilib = require("../../lib/ilib.js"); +} + +module.exports.testunitfmt_be_BY = { + setUp: function(callback) { + ilib.clearCache(); + callback(); + }, + testUnitFormatGetLocale_be_BY: function(test) { + test.expect(2); + var uf = new UnitFmt({ + locale: "be-BY" + }); + test.ok(uf.getLocale()); + test.equal(uf.getLocale().getSpec(), "be-BY"); + test.done(); + }, + testGetMeasurementSystem_be_BY: function(test) { + test.expect(1); + + test.equal(Measurement.getMeasurementSystemForLocale("be-BY"), "metric"); + test.done(); + }, + testUnitFormatTemperature1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "fahrenheit", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + length: "short", + autoConvert: true, + maxFractionDigits: 2, + roundingMode: "down" + }); + var str = uf.format(m1); + test.equal(str, "-16,66 °C"); + test.done(); + }, + testUnitFormatTemperature2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "fahrenheit", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + autoScale: true, + length: "long" + }); + var str = uf.format(m1); + test.equal(str, "-16,666666666666668 градусы Цэльсія"); + test.done(); + }, + testUnitFormatArea1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "square centimeter", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert:true, + length:"short" + }); + + var str = uf.format(m1); + test.equal(str, "2 см²"); + test.done(); + }, + testUnitFormatArea2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "square centimeter", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "long" + }); + + var str = uf.format(m1); + test.equal(str, "2 квадратныя сантыметры"); + test.done(); + }, + testUnitFormatArea3_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "hectare", + amount: 1000 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "short" + }); + + var str = uf.format(m1); + test.equal(str, "10 км²"); + test.done(); + }, + testUnitFormatArea4_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "hectare", + amount: 1000 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "long" + }); + + var str = uf.format(m1); + test.equal(str, "10 квадратных кіламетраў"); + test.done(); + }, + testUnitFormatFuelConsumption1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "km/liter", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "short" + }); + var str = uf.format(m1); + test.equal(str, "2 км/л"); + test.done(); + }, + testUnitFormatFuelConsumption2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "km/liter", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "long" + }); + var str = uf.format(m1); + test.equal(str, "2 кіламетра на літр"); + test.done(); + }, + testUnitFormatLength1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "mile", + amount: 2000 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "short" + }); + var str = uf.format(m1); + test.equal(str, "3,21868 Mm"); + test.done(); + }, + testUnitFormatLength2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "mile", + amount: 2000 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + autoConvert: true, + length: "long" + }); + var str = uf.format(m1); + test.equal(str, "3,21868 megameters"); + test.done(); + }, + testUnitFormatWithUsageVehicleDistance1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "km", + amount: 10 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "vehicleDistance", + length: "short", + autoConvert: true, + }); + var str = uf.format(m1); + test.equal(str, "10 км"); + test.done(); + }, + testUnitFormatWithUsageVehicleDistance2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "km", + amount: 10 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "vehicleDistance", + length: "long", + autoConvert: true + }); + var str = uf.format(m1); + test.equal(str, "10 кіламетраў"); + test.done(); + }, + testUnitFormatWithUsageFuelVolume1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "imperial gallon", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "fuelVolume", + length: "short", + autoConvert: true + }); + + var str = uf.format(m1); + test.equal(str, "9,09 л"); + test.done(); + }, + testUnitFormatWithUsageFuelVolume2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "imperial gallon", + amount: 2 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "fuelVolume", + length: "long", + autoConvert: true + }); + + var str = uf.format(m1); + test.equal(str, "9,09 літра"); + test.done(); + }, + testUnitFormatWithUsageOverrideSignificantDigits1_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "kWh", + amount: 102.338322234 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "electricalEnergy", + length: "short", + significantDigits: "6", + autoConvert: true + }); + + var str = uf.format(m1); + test.equal(str, "102,338 кВт·г"); + test.done(); + }, + testUnitFormatWithUsageOverrideSignificantDigits2_be_BY: function(test) { + test.expect(1); + var m1 = MeasurementFactory({ + unit: "kWh", + amount: 102.338322234 + }); + + var uf = new UnitFmt({ + locale: "be-BY", + usage: "electricalEnergy", + length: "long", + significantDigits: "6", + autoConvert: true + }); + + var str = uf.format(m1); + test.equal(str, "102,338 кілават-гадзіны"); + test.done(); + } +} \ No newline at end of file From 1cc63fe4029ffe44d7456383a5ec5a92637f34da Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Thu, 20 Aug 2020 17:54:25 +0900 Subject: [PATCH 7/8] Write newly added file in testSuite.html --- js/test/date/testSuite.html | 1 + js/test/daterange/testSuite.html | 1 + js/test/strings-ext/testSuite.html | 1 + js/test/units/testSuite.html | 1 + 4 files changed, 4 insertions(+) diff --git a/js/test/date/testSuite.html b/js/test/date/testSuite.html index 98d7e4a687..18554aed9e 100644 --- a/js/test/date/testSuite.html +++ b/js/test/date/testSuite.html @@ -48,6 +48,7 @@ + diff --git a/js/test/daterange/testSuite.html b/js/test/daterange/testSuite.html index 3d48d1a1e9..064b1e5482 100644 --- a/js/test/daterange/testSuite.html +++ b/js/test/daterange/testSuite.html @@ -38,6 +38,7 @@ + diff --git a/js/test/strings-ext/testSuite.html b/js/test/strings-ext/testSuite.html index ea49ebf3d4..6108515c75 100644 --- a/js/test/strings-ext/testSuite.html +++ b/js/test/strings-ext/testSuite.html @@ -35,6 +35,7 @@ + diff --git a/js/test/units/testSuite.html b/js/test/units/testSuite.html index 39c7e003c9..f7a94144df 100644 --- a/js/test/units/testSuite.html +++ b/js/test/units/testSuite.html @@ -43,6 +43,7 @@ + From e4654e5760ea91ac5667cefd23b5c0b21c1136e7 Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Mon, 31 Aug 2020 15:52:55 +0900 Subject: [PATCH 8/8] Apply feedback: update unit tc, copyright year... --- js/test/date/testSuite.html | 2 +- js/test/date/testSuiteFiles.js | 2 +- js/test/daterange/testSuite.html | 2 +- js/test/daterange/testSuiteFiles.js | 2 +- js/test/root/testcountry.js | 2 +- js/test/strings-ext/testSuite.html | 2 +- js/test/strings-ext/testSuiteCompiled.html | 3 ++- js/test/strings-ext/testSuiteFiles.js | 2 +- js/test/units/testSuite.html | 2 +- js/test/units/testSuiteFiles.js | 2 +- js/test/units/testunitfmt_be_BY.js | 8 ++++---- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/js/test/date/testSuite.html b/js/test/date/testSuite.html index 18554aed9e..10f62c6c77 100644 --- a/js/test/date/testSuite.html +++ b/js/test/date/testSuite.html @@ -1,7 +1,7 @@