From f5603f65e716686304479bae966eaecb40360a15 Mon Sep 17 00:00:00 2001 From: Iskren Chernev Date: Mon, 31 Mar 2014 21:13:30 -0700 Subject: [PATCH] Make sure no Date constructor is used in tests --- moment.js | 9 +++++- test/lang/ar-ma.js | 3 ++ test/lang/ar.js | 3 ++ test/lang/bg.js | 3 ++ test/lang/br.js | 7 +++-- test/lang/bs.js | 3 ++ test/lang/ca.js | 7 +++-- test/lang/cs.js | 3 ++ test/lang/cv.js | 7 +++-- test/lang/cy.js | 7 +++-- test/lang/da.js | 7 +++-- test/lang/de.js | 7 +++-- test/lang/el.js | 7 +++-- test/lang/en-au.js | 3 ++ test/lang/en-ca.js | 7 +++-- test/lang/en-gb.js | 3 ++ test/lang/en.js | 3 ++ test/lang/eo.js | 7 +++-- test/lang/es.js | 3 ++ test/lang/et.js | 9 ++++-- test/lang/eu.js | 7 +++-- test/lang/fa.js | 7 +++-- test/lang/fi.js | 7 +++-- test/lang/fo.js | 7 +++-- test/lang/fr-ca.js | 7 +++-- test/lang/fr.js | 7 +++-- test/lang/gl.js | 7 +++-- test/lang/he.js | 7 +++-- test/lang/hi.js | 7 +++-- test/lang/hr.js | 7 +++-- test/lang/hu.js | 7 +++-- test/lang/hy-am.js | 9 ++++-- test/lang/id.js | 7 +++-- test/lang/is.js | 9 ++++-- test/lang/it.js | 7 +++-- test/lang/ja.js | 7 +++-- test/lang/ka.js | 3 ++ test/lang/ko.js | 3 ++ test/lang/lb.js | 3 ++ test/lang/lt.js | 7 +++-- test/lang/lv.js | 7 +++-- test/lang/mk.js | 3 ++ test/lang/ml.js | 7 +++-- test/lang/mr.js | 7 +++-- test/lang/ms-my.js | 7 +++-- test/lang/nb.js | 7 +++-- test/lang/ne.js | 7 +++-- test/lang/nl.js | 7 +++-- test/lang/nn.js | 3 ++ test/lang/pl.js | 7 +++-- test/lang/pt-br.js | 7 +++-- test/lang/pt.js | 7 +++-- test/lang/ro.js | 7 +++-- test/lang/ru.js | 7 +++-- test/lang/sk.js | 7 +++-- test/lang/sl.js | 7 +++-- test/lang/sq.js | 3 ++ test/lang/sr-cyr.js | 3 ++ test/lang/sr.js | 5 ++- test/lang/sv.js | 7 +++-- test/lang/ta.js | 49 ++++++++++++++++-------------- test/lang/th.js | 7 +++-- test/lang/tl-ph.js | 3 ++ test/lang/tr.js | 7 +++-- test/lang/tzm-la.js | 7 +++-- test/lang/tzm.js | 3 ++ test/lang/uk.js | 7 +++-- test/lang/uz.js | 7 +++-- test/lang/vi.js | 7 +++-- test/lang/zh-cn.js | 3 ++ test/lang/zh-tw.js | 7 +++-- test/moment/add_subtract.js | 7 +++++ test/moment/create.js | 7 +++++ test/moment/days_in_month.js | 7 +++++ test/moment/diff.js | 7 +++++ test/moment/duration.js | 7 +++++ test/moment/format.js | 7 +++++ test/moment/getters_setters.js | 7 +++++ test/moment/invalid.js | 7 +++++ test/moment/is_after.js | 7 +++++ test/moment/is_before.js | 7 +++++ test/moment/is_moment.js | 7 +++++ test/moment/is_same.js | 7 +++++ test/moment/is_valid.js | 7 +++++ test/moment/lang.js | 7 +++++ test/moment/leapyear.js | 7 +++++ test/moment/listers.js | 4 +++ test/moment/min_max.js | 3 ++ test/moment/mutable.js | 7 +++++ test/moment/normalizeUnits.js | 7 +++++ test/moment/parsing_flags.js | 7 +++++ test/moment/preparse_postformat.js | 4 +++ test/moment/quarter.js | 7 +++++ test/moment/sod_eod.js | 7 +++-- test/moment/string_prototype.js | 7 +++++ test/moment/utc.js | 8 +++-- test/moment/week_year.js | 7 +++++ test/moment/weekday.js | 7 +++++ test/moment/weeks.js | 8 +++-- test/moment/zones.js | 8 +++-- 100 files changed, 531 insertions(+), 134 deletions(-) diff --git a/moment.js b/moment.js index b059e0a82..991d2bace 100644 --- a/moment.js +++ b/moment.js @@ -1434,8 +1434,11 @@ config._d = new Date(+input); } else if (typeof(input) === 'object') { dateFromObject(config); - } else { + } else if (typeof(input) === 'number') { + // from milliseconds config._d = new Date(input); + } else { + moment.createFromInputFallback(config); } } @@ -1608,6 +1611,10 @@ return makeMoment(c); }; + moment.createFromInputFallback = function (config) { + config._d = new Date(config._i); + }; + // creating with utc moment.utc = function (input, format, lang, strict) { var c; diff --git a/test/lang/ar-ma.js b/test/lang/ar-ma.js index edded5dad..5536a303b 100644 --- a/test/lang/ar-ma.js +++ b/test/lang/ar-ma.js @@ -5,6 +5,9 @@ var moment = require("../../moment"); exports["lang:ar-ma"] = { setUp : function (cb) { moment.lang('ar-ma'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/ar.js b/test/lang/ar.js index 098b802e2..f0f81f343 100644 --- a/test/lang/ar.js +++ b/test/lang/ar.js @@ -5,6 +5,9 @@ var moment = require("../../moment"); exports["lang:ar"] = { setUp : function (cb) { moment.lang('ar'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/bg.js b/test/lang/bg.js index f28e693d3..33d35f929 100644 --- a/test/lang/bg.js +++ b/test/lang/bg.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:bg"] = { setUp : function (cb) { moment.lang('bg'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/br.js b/test/lang/br.js index 7e007a7e3..f1350d386 100644 --- a/test/lang/br.js +++ b/test/lang/br.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:br"] = { setUp : function (cb) { moment.lang('br'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -268,12 +271,12 @@ exports["lang:br"] = { test.equal(start.from(moment([2007, 1, 28]).add({y: 261}), true), "261 bloaz", "mutation 261 years"); test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/br'), 'br', "module should export br"); } - + test.done(); } }; diff --git a/test/lang/bs.js b/test/lang/bs.js index 10930e191..4f1834b6c 100644 --- a/test/lang/bs.js +++ b/test/lang/bs.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:bs"] = { setUp : function (cb) { moment.lang('bs'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/ca.js b/test/lang/ca.js index fbf68fe7a..d17f38dd7 100644 --- a/test/lang/ca.js +++ b/test/lang/ca.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ca"] = { setUp : function (cb) { moment.lang('ca'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -315,12 +318,12 @@ exports["lang:ca"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ca'), 'ca', "module should export ca"); } - + test.done(); } }; diff --git a/test/lang/cs.js b/test/lang/cs.js index ada0edf02..06d853e89 100644 --- a/test/lang/cs.js +++ b/test/lang/cs.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:cs"] = { setUp : function (cb) { moment.lang('cs'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/cv.js b/test/lang/cv.js index 27d81a9d2..7dfff781d 100644 --- a/test/lang/cv.js +++ b/test/lang/cv.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:cv"] = { setUp : function (cb) { moment.lang('cv'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -354,12 +357,12 @@ exports["lang:cv"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/cv'), 'cv', "module should export cv"); } - + test.done(); } }; diff --git a/test/lang/cy.js b/test/lang/cy.js index 362b89be0..dec695e7a 100644 --- a/test/lang/cy.js +++ b/test/lang/cy.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:cy"] = { setUp : function (cb) { moment.lang('cy'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -351,12 +354,12 @@ exports["lang:cy"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/cy'), 'cy', "module should export cy"); } - + test.done(); } }; diff --git a/test/lang/da.js b/test/lang/da.js index 5c5ba26e1..685c85e24 100644 --- a/test/lang/da.js +++ b/test/lang/da.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:da"] = { setUp : function (cb) { moment.lang('da'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -286,12 +289,12 @@ exports["lang:da"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/da'), 'da', "module should export da"); } - + test.done(); } }; diff --git a/test/lang/de.js b/test/lang/de.js index f97c08d41..1a4cc4397 100644 --- a/test/lang/de.js +++ b/test/lang/de.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:de"] = { setUp : function (cb) { moment.lang('de'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -347,12 +350,12 @@ exports["lang:de"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/de'), 'de', "module should export de"); } - + test.done(); } }; diff --git a/test/lang/el.js b/test/lang/el.js index 59bafd3a2..88c94428f 100644 --- a/test/lang/el.js +++ b/test/lang/el.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:el"] = { setUp : function (cb) { moment.lang('el'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -378,12 +381,12 @@ exports["lang:el"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/el'), 'el', "module should export el"); } - + test.done(); } }; diff --git a/test/lang/en-au.js b/test/lang/en-au.js index 0a7a824e3..954f72b9a 100644 --- a/test/lang/en-au.js +++ b/test/lang/en-au.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:en-au"] = { setUp : function (cb) { moment.lang('en-au'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/en-ca.js b/test/lang/en-ca.js index 1703511b5..623eb0916 100644 --- a/test/lang/en-ca.js +++ b/test/lang/en-ca.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:en-ca"] = { setUp : function (cb) { moment.lang('en-ca'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -375,12 +378,12 @@ exports["lang:en-ca"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/en-ca'), 'en-ca', "module should export en-ca"); } - + test.done(); } }; diff --git a/test/lang/en-gb.js b/test/lang/en-gb.js index 5ebe4519e..e283e3aee 100644 --- a/test/lang/en-gb.js +++ b/test/lang/en-gb.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:en-gb"] = { setUp : function (cb) { moment.lang('en-gb'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/en.js b/test/lang/en.js index 7a0e8b05a..85c4f8c82 100644 --- a/test/lang/en.js +++ b/test/lang/en.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:en"] = { setUp : function (cb) { moment.lang('en'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/eo.js b/test/lang/eo.js index 57455fe91..828f97413 100644 --- a/test/lang/eo.js +++ b/test/lang/eo.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:eo"] = { setUp : function (cb) { moment.lang('eo'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -356,12 +359,12 @@ exports["lang:eo"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/eo'), 'eo', "module should export eo"); } - + test.done(); } }; diff --git a/test/lang/es.js b/test/lang/es.js index ef5880981..d2d9ec712 100644 --- a/test/lang/es.js +++ b/test/lang/es.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:es"] = { setUp : function (cb) { moment.lang('es'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/et.js b/test/lang/et.js index b0d9cace3..b2cc646e9 100644 --- a/test/lang/et.js +++ b/test/lang/et.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:et"] = { setUp : function (cb) { moment.lang('et'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -189,7 +192,7 @@ exports["lang:et"] = { test.equal(moment().add({s: 30}).fromNow(), "mõne sekundi pärast", "in a few seconds"); test.equal(moment().subtract({s: 30}).fromNow(), "mõni sekund tagasi", "a few seconds ago"); - + test.equal(moment().add({m: 1}).fromNow(), "ühe minuti pärast", "in a minute"); test.equal(moment().subtract({m: 1}).fromNow(), "üks minut tagasi", "a minute ago"); @@ -381,12 +384,12 @@ exports["lang:et"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/et'), 'et', "module should export et"); } - + test.done(); } }; diff --git a/test/lang/eu.js b/test/lang/eu.js index 1c0f12b6f..d47f66707 100644 --- a/test/lang/eu.js +++ b/test/lang/eu.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:eu"] = { setUp : function (cb) { moment.lang('eu'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -353,12 +356,12 @@ exports["lang:eu"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/eu'), 'eu', "module should export eu"); } - + test.done(); } }; diff --git a/test/lang/fa.js b/test/lang/fa.js index 75f0de97e..0086e77d0 100644 --- a/test/lang/fa.js +++ b/test/lang/fa.js @@ -5,6 +5,9 @@ var moment = require("../../moment"); exports["lang:fa"] = { setUp : function (cb) { moment.lang('fa'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -335,12 +338,12 @@ exports["lang:fa"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/fa'), 'fa', "module should export fa"); } - + test.done(); } }; diff --git a/test/lang/fi.js b/test/lang/fi.js index c85bfb871..98febccec 100644 --- a/test/lang/fi.js +++ b/test/lang/fi.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:fi"] = { setUp : function (cb) { moment.lang('fi'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -348,12 +351,12 @@ exports["lang:fi"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/fi'), 'fi', "module should export fi"); } - + test.done(); } }; diff --git a/test/lang/fo.js b/test/lang/fo.js index 98d173648..db53caa64 100644 --- a/test/lang/fo.js +++ b/test/lang/fo.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:fo"] = { setUp : function (cb) { moment.lang('fo'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -286,12 +289,12 @@ exports["lang:fo"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/fo'), 'fo', "module should export fo"); } - + test.done(); } }; diff --git a/test/lang/fr-ca.js b/test/lang/fr-ca.js index b9e43559c..dd3545edf 100644 --- a/test/lang/fr-ca.js +++ b/test/lang/fr-ca.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:fr-ca"] = { setUp : function (cb) { moment.lang('fr-ca'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -368,12 +371,12 @@ exports["lang:fr-ca"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/fr-ca'), 'fr-ca', "module should export fr-ca"); } - + test.done(); } }; diff --git a/test/lang/fr.js b/test/lang/fr.js index 5de9a7b49..80b7dea24 100644 --- a/test/lang/fr.js +++ b/test/lang/fr.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:fr"] = { setUp : function (cb) { moment.lang('fr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -351,12 +354,12 @@ exports["lang:fr"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/fr'), 'fr', "module should export fr"); } - + test.done(); } }; diff --git a/test/lang/gl.js b/test/lang/gl.js index 2a78bb969..54c20616e 100644 --- a/test/lang/gl.js +++ b/test/lang/gl.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:gl"] = { setUp : function (cb) { moment.lang('gl'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -332,12 +335,12 @@ exports["lang:gl"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/gl'), 'gl', "module should export gl"); } - + test.done(); } }; diff --git a/test/lang/he.js b/test/lang/he.js index 146d912c4..6c04f08e5 100644 --- a/test/lang/he.js +++ b/test/lang/he.js @@ -8,6 +8,9 @@ exports["lang:he"] = { setUp : function (cb) { moment.lang('he'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -311,12 +314,12 @@ exports["lang:he"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/he'), 'he', "module should export he"); } - + test.done(); } }; diff --git a/test/lang/hi.js b/test/lang/hi.js index e6ff68576..90c179779 100644 --- a/test/lang/hi.js +++ b/test/lang/hi.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:hi"] = { setUp : function (cb) { moment.lang('hi'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -374,12 +377,12 @@ exports["lang:hi"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/hi'), 'hi', "module should export hi"); } - + test.done(); } }; diff --git a/test/lang/hr.js b/test/lang/hr.js index 7316f7eaf..0f0ea3e58 100644 --- a/test/lang/hr.js +++ b/test/lang/hr.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:hr"] = { setUp : function (cb) { moment.lang('hr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -382,12 +385,12 @@ exports["lang:hr"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/hr'), 'hr', "module should export hr"); } - + test.done(); } }; diff --git a/test/lang/hu.js b/test/lang/hu.js index 192966b29..f807fa914 100644 --- a/test/lang/hu.js +++ b/test/lang/hu.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:hu"] = { setUp : function (cb) { moment.lang('hu'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -353,12 +356,12 @@ exports["lang:hu"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/hu'), 'hu', "module should export hu"); } - + test.done(); } }; diff --git a/test/lang/hy-am.js b/test/lang/hy-am.js index dad53650e..3871bcfe8 100644 --- a/test/lang/hy-am.js +++ b/test/lang/hy-am.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:hy-am"] = { setUp : function (cb) { moment.lang('hy-am'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -438,13 +441,13 @@ exports["lang:hy-am"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/hy-am'), 'hy-am', "module should export hy"); } - + test.done(); } - + }; diff --git a/test/lang/id.js b/test/lang/id.js index 93ca9906f..4ed3d9b9c 100644 --- a/test/lang/id.js +++ b/test/lang/id.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:id"] = { setUp : function (cb) { moment.lang('id'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -308,12 +311,12 @@ exports["lang:id"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/id'), 'id', "module should export id"); } - + test.done(); } }; diff --git a/test/lang/is.js b/test/lang/is.js index b727b4349..57adf39db 100644 --- a/test/lang/is.js +++ b/test/lang/is.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:is"] = { setUp : function (cb) { moment.lang('is'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -361,13 +364,13 @@ exports["lang:is"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { - + test.equal(require('../../lang/is'), 'is', "module should export is"); } - + test.done(); } }; diff --git a/test/lang/it.js b/test/lang/it.js index 321a5805e..3e326ab88 100644 --- a/test/lang/it.js +++ b/test/lang/it.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:it"] = { setUp : function (cb) { moment.lang('it'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -349,12 +352,12 @@ exports["lang:it"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/it'), 'it', "module should export it"); } - + test.done(); } }; diff --git a/test/lang/ja.js b/test/lang/ja.js index 127f1ce94..849d63aac 100644 --- a/test/lang/ja.js +++ b/test/lang/ja.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ja"] = { setUp : function (cb) { moment.lang('ja'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -313,12 +316,12 @@ exports["lang:ja"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ja'), 'ja', "module should export ja"); } - + test.done(); } }; diff --git a/test/lang/ka.js b/test/lang/ka.js index ed0c7ade6..d383004ae 100644 --- a/test/lang/ka.js +++ b/test/lang/ka.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:ka"] = { setUp : function (cb) { moment.lang('ka'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/ko.js b/test/lang/ko.js index 839061d45..7bad59f69 100644 --- a/test/lang/ko.js +++ b/test/lang/ko.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:kr"] = { setUp : function (cb) { moment.lang('ko'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/lb.js b/test/lang/lb.js index dbac991c5..0e0f31d92 100644 --- a/test/lang/lb.js +++ b/test/lang/lb.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:lb"] = { setUp: function (cb) { moment.lang('lb'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/lt.js b/test/lang/lt.js index 996693b90..516939111 100644 --- a/test/lang/lt.js +++ b/test/lang/lt.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:lt"] = { setUp : function (cb) { moment.lang('lt'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -359,12 +362,12 @@ exports["lang:lt"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/lt'), 'lt', "module should export lt"); } - + test.done(); } }; diff --git a/test/lang/lv.js b/test/lang/lv.js index 66232b071..2f82c8fde 100644 --- a/test/lang/lv.js +++ b/test/lang/lv.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:lv"] = { setUp : function (cb) { moment.lang('lv'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -352,12 +355,12 @@ exports["lang:lv"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/lv'), 'lv', "module should export lv"); } - + test.done(); } }; diff --git a/test/lang/mk.js b/test/lang/mk.js index debe32a7d..9581756b7 100644 --- a/test/lang/mk.js +++ b/test/lang/mk.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:mk"] = { "setUp" : function (cb) { moment.lang('mk'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/ml.js b/test/lang/ml.js index efb2d1901..19223f221 100644 --- a/test/lang/ml.js +++ b/test/lang/ml.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ml"] = { setUp : function (cb) { moment.lang('ml'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -374,12 +377,12 @@ exports["lang:ml"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ml'), 'ml', "module should export ml"); } - + test.done(); } }; diff --git a/test/lang/mr.js b/test/lang/mr.js index 5be909d99..4fe90a208 100644 --- a/test/lang/mr.js +++ b/test/lang/mr.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:mr"] = { setUp : function (cb) { moment.lang('mr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -374,12 +377,12 @@ exports["lang:mr"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/mr'), 'mr', "module should export mr"); } - + test.done(); } }; diff --git a/test/lang/ms-my.js b/test/lang/ms-my.js index 4ac521aa4..1c673f30b 100644 --- a/test/lang/ms-my.js +++ b/test/lang/ms-my.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ms-my"] = { setUp : function (cb) { moment.lang('ms-my'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -374,12 +377,12 @@ exports["lang:ms-my"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ms-my'), 'ms-my', "module should export ms-my"); } - + test.done(); } }; diff --git a/test/lang/nb.js b/test/lang/nb.js index 59763276d..ff5b83e56 100644 --- a/test/lang/nb.js +++ b/test/lang/nb.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:nb"] = { setUp : function (cb) { moment.lang('nb'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -353,12 +356,12 @@ exports["lang:nb"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/nb'), 'nb', "module should export nb"); } - + test.done(); } }; diff --git a/test/lang/ne.js b/test/lang/ne.js index c1500ffa9..59dcc8ca7 100644 --- a/test/lang/ne.js +++ b/test/lang/ne.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ne"] = { setUp : function (cb) { moment.lang('ne'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -372,12 +375,12 @@ exports["lang:ne"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ne'), 'ne', "module should export ne"); } - + test.done(); } }; diff --git a/test/lang/nl.js b/test/lang/nl.js index 53c12dbfa..f1e146d17 100644 --- a/test/lang/nl.js +++ b/test/lang/nl.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:nl"] = { setUp : function (cb) { moment.lang('nl'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -363,12 +366,12 @@ exports["lang:nl"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/nl'), 'nl', "module should export nl"); } - + test.done(); } }; diff --git a/test/lang/nn.js b/test/lang/nn.js index b16b4deb0..96a1745aa 100644 --- a/test/lang/nn.js +++ b/test/lang/nn.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:nn"] = { setUp : function (cb) { moment.lang('nn'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/pl.js b/test/lang/pl.js index ea747a720..fe9caad1a 100644 --- a/test/lang/pl.js +++ b/test/lang/pl.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:pl"] = { setUp : function (cb) { moment.lang('pl'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -375,12 +378,12 @@ exports["lang:pl"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/pl'), 'pl', "module should export pl"); } - + test.done(); } }; diff --git a/test/lang/pt-br.js b/test/lang/pt-br.js index a55b2610d..c75d90606 100644 --- a/test/lang/pt-br.js +++ b/test/lang/pt-br.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:pt-br"] = { setUp : function (cb) { moment.lang('pt-br'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -354,12 +357,12 @@ exports["lang:pt-br"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/pt-br'), 'pt-br', "module should export pt-br"); } - + test.done(); } }; diff --git a/test/lang/pt.js b/test/lang/pt.js index e56f175c3..5bf4f9da6 100644 --- a/test/lang/pt.js +++ b/test/lang/pt.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:pt"] = { setUp : function (cb) { moment.lang('pt'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -344,12 +347,12 @@ exports["lang:pt"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/pt'), 'pt', "module should export pt"); } - + test.done(); } }; diff --git a/test/lang/ro.js b/test/lang/ro.js index 684127555..d30adc15d 100644 --- a/test/lang/ro.js +++ b/test/lang/ro.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ro"] = { setUp : function (cb) { moment.lang('ro'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -361,12 +364,12 @@ exports["lang:ro"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ro'), 'ro', "module should export ro"); } - + test.done(); } }; diff --git a/test/lang/ru.js b/test/lang/ru.js index f1aecded6..229ceedb8 100644 --- a/test/lang/ru.js +++ b/test/lang/ru.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ru"] = { setUp : function (cb) { moment.lang('ru'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -449,12 +452,12 @@ exports["lang:ru"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/ru'), 'ru', "module should export ru"); } - + test.done(); } }; diff --git a/test/lang/sk.js b/test/lang/sk.js index 3dfbbdfcb..69b4d8671 100644 --- a/test/lang/sk.js +++ b/test/lang/sk.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:sk"] = { setUp : function (cb) { moment.lang('sk'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -438,12 +441,12 @@ exports["lang:sk"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/sk'), 'sk', "module should export sk"); } - + test.done(); } }; diff --git a/test/lang/sl.js b/test/lang/sl.js index bb7b5d2ce..ec5670a5a 100644 --- a/test/lang/sl.js +++ b/test/lang/sl.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:sl"] = { setUp : function (cb) { moment.lang('sl'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -381,12 +384,12 @@ exports["lang:sl"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/sl'), 'sl', "module should export sl"); } - + test.done(); } }; diff --git a/test/lang/sq.js b/test/lang/sq.js index 63f0f5b7b..b07974231 100644 --- a/test/lang/sq.js +++ b/test/lang/sq.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:sq"] = { setUp : function (cb) { moment.lang('sq'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/sr-cyr.js b/test/lang/sr-cyr.js index 3a56dd37b..95d0bbd4b 100644 --- a/test/lang/sr-cyr.js +++ b/test/lang/sr-cyr.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:sr-cyr"] = { setUp : function (cb) { moment.lang('sr-cyr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/sr.js b/test/lang/sr.js index daa7571bf..c0556b955 100644 --- a/test/lang/sr.js +++ b/test/lang/sr.js @@ -7,7 +7,10 @@ var moment = require("../../moment"); exports["lang:sr"] = { setUp : function (cb) { - moment.lang('sr-lat'); + moment.lang('sr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/sv.js b/test/lang/sv.js index f4546151c..2a9047b9e 100644 --- a/test/lang/sv.js +++ b/test/lang/sv.js @@ -7,6 +7,9 @@ var moment = require("../../moment"); exports["lang:sv"] = { setUp : function (cb) { moment.lang('sv'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -346,12 +349,12 @@ exports["lang:sv"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/sv'), 'sv', "module should export sv"); } - + test.done(); } }; diff --git a/test/lang/ta.js b/test/lang/ta.js index 3141cea1e..25ead5d4f 100644 --- a/test/lang/ta.js +++ b/test/lang/ta.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:ta"] = { setUp : function (cb) { moment.lang('ta'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -39,28 +42,28 @@ exports["lang:ta"] = { "format" : function (test) { test.expect(22); var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி 14வது 2010, 3:25:50 எற்பாடு'], - ['ddd, hA', 'ஞாயிறு, 3 எற்பாடு'], - ['M Mo MM MMMM MMM', '2 2வது 02 பிப்ரவரி பிப்ரவரி'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14வது 14'], - ['d do dddd ddd dd', '0 0வது ஞாயிற்றுக்கிழமை ஞாயிறு ஞா'], - ['DDD DDDo DDDD', '45 45வது 045'], - ['w wo ww', '8 8வது 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', ' எற்பாடு எற்பாடு'], - ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் 45வது நாள்'], - ['L', '14/02/2010'], - ['LL', '14 பிப்ரவரி 2010'], - ['LLL', '14 பிப்ரவரி 2010, 15:25'], - ['LLLL', 'ஞாயிற்றுக்கிழமை, 14 பிப்ரவரி 2010, 15:25'], - ['l', '14/2/2010'], - ['ll', '14 பிப்ரவரி 2010'], - ['lll', '14 பிப்ரவரி 2010, 15:25'], - ['llll', 'ஞாயிறு, 14 பிப்ரவரி 2010, 15:25'] + ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி 14வது 2010, 3:25:50 எற்பாடு'], + ['ddd, hA', 'ஞாயிறு, 3 எற்பாடு'], + ['M Mo MM MMMM MMM', '2 2வது 02 பிப்ரவரி பிப்ரவரி'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 14வது 14'], + ['d do dddd ddd dd', '0 0வது ஞாயிற்றுக்கிழமை ஞாயிறு ஞா'], + ['DDD DDDo DDDD', '45 45வது 045'], + ['w wo ww', '8 8வது 08'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', ' எற்பாடு எற்பாடு'], + ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் 45வது நாள்'], + ['L', '14/02/2010'], + ['LL', '14 பிப்ரவரி 2010'], + ['LLL', '14 பிப்ரவரி 2010, 15:25'], + ['LLLL', 'ஞாயிற்றுக்கிழமை, 14 பிப்ரவரி 2010, 15:25'], + ['l', '14/2/2010'], + ['ll', '14 பிப்ரவரி 2010'], + ['lll', '14 பிப்ரவரி 2010, 15:25'], + ['llll', 'ஞாயிறு, 14 பிப்ரவரி 2010, 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -110,7 +113,7 @@ exports["lang:ta"] = { }, "format month" : function (test) { - test.expect(12); + test.expect(12); var expected = 'ஜனவரி ஜனவரி_பிப்ரவரி பிப்ரவரி_மார்ச் மார்ச்_ஏப்ரல் ஏப்ரல்_மே மே_ஜூன் ஜூன்_ஜூலை ஜூலை_ஆகஸ்ட் ஆகஸ்ட்_செப்டெம்பர் செப்டெம்பர்_அக்டோபர் அக்டோபர்_நவம்பர் நவம்பர்_டிசம்பர் டிசம்பர்'.split("_"), i; for (i = 0; i < expected.length; i++) { test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); diff --git a/test/lang/th.js b/test/lang/th.js index cf64a46b2..f1949acc8 100644 --- a/test/lang/th.js +++ b/test/lang/th.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:th"] = { setUp : function (cb) { moment.lang('th'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -313,12 +316,12 @@ exports["lang:th"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/th'), 'th', "module should export th"); } - + test.done(); } }; diff --git a/test/lang/tl-ph.js b/test/lang/tl-ph.js index f2281f231..6bdc8ddcd 100644 --- a/test/lang/tl-ph.js +++ b/test/lang/tl-ph.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:tl-ph"] = { setUp : function (cb) { moment.lang('tl-ph'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/tr.js b/test/lang/tr.js index 222b6cbe2..c5ae0d713 100644 --- a/test/lang/tr.js +++ b/test/lang/tr.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:tr"] = { setUp : function (cb) { moment.lang('tr'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -364,12 +367,12 @@ exports["lang:tr"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/tr'), 'tr', "module should export tr"); } - + test.done(); } }; diff --git a/test/lang/tzm-la.js b/test/lang/tzm-la.js index 5498a5dda..21b0f3589 100644 --- a/test/lang/tzm-la.js +++ b/test/lang/tzm-la.js @@ -6,6 +6,9 @@ var moment = require("../../moment"); exports["lang:tzm-la"] = { setUp : function (cb) { moment.lang('tzm-la'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -352,12 +355,12 @@ exports["lang:tzm-la"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/tzm-la'), 'tzm-la', "module should export tzm-la"); } - + test.done(); } }; diff --git a/test/lang/tzm.js b/test/lang/tzm.js index 79d391c1e..dc7a3345b 100644 --- a/test/lang/tzm.js +++ b/test/lang/tzm.js @@ -6,6 +6,9 @@ var moment = require("../../moment"); exports["lang:tzm"] = { setUp : function (cb) { moment.lang('tzm'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/uk.js b/test/lang/uk.js index b61b786c5..6da4afd9e 100644 --- a/test/lang/uk.js +++ b/test/lang/uk.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:uk"] = { setUp : function (cb) { moment.lang('uk'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -383,12 +386,12 @@ exports["lang:uk"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/uk'), 'uk', "module should export uk"); } - + test.done(); } }; diff --git a/test/lang/uz.js b/test/lang/uz.js index 6ac3a6a54..697ee888d 100644 --- a/test/lang/uz.js +++ b/test/lang/uz.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:uz"] = { setUp : function (cb) { moment.lang('uz'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -350,12 +353,12 @@ exports["lang:uz"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/uz'), 'uz', "module should export uz"); } - + test.done(); } }; diff --git a/test/lang/vi.js b/test/lang/vi.js index a3856da69..c5bf2e3f1 100644 --- a/test/lang/vi.js +++ b/test/lang/vi.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:vi"] = { setUp : function (cb) { moment.lang('vi'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -376,12 +379,12 @@ exports["lang:vi"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/vi'), 'vi', "module should export vi"); } - + test.done(); } }; diff --git a/test/lang/zh-cn.js b/test/lang/zh-cn.js index c991c57d4..49353ddd3 100644 --- a/test/lang/zh-cn.js +++ b/test/lang/zh-cn.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:zh-cn"] = { setUp : function (cb) { moment.lang('zh-cn'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/lang/zh-tw.js b/test/lang/zh-tw.js index 6ca0fa9a4..a91cf12d9 100644 --- a/test/lang/zh-tw.js +++ b/test/lang/zh-tw.js @@ -8,6 +8,9 @@ var moment = require("../../moment"); exports["lang:zh-tw"] = { setUp : function (cb) { moment.lang('zh-tw'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, @@ -348,12 +351,12 @@ exports["lang:zh-tw"] = { test.done(); }, - + "returns the name of the language" : function (test) { if (typeof module !== 'undefined' && module.exports) { test.equal(require('../../lang/zh-tw'), 'zh-tw', "module should export zh-tw"); } - + test.done(); } }; diff --git a/test/moment/add_subtract.js b/test/moment/add_subtract.js index 85b4046bf..0dbd5d207 100644 --- a/test/moment/add_subtract.js +++ b/test/moment/add_subtract.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.add = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "add short" : function (test) { test.expect(12); diff --git a/test/moment/create.js b/test/moment/create.js index c0a3a606c..4d614365d 100644 --- a/test/moment/create.js +++ b/test/moment/create.js @@ -13,6 +13,13 @@ var getVerifier = function (test) { }; exports.create = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "array" : function (test) { test.expect(8); test.ok(moment([2010]).toDate() instanceof Date, "[2010]"); diff --git a/test/moment/days_in_month.js b/test/moment/days_in_month.js index 2b7865578..aa4e23d0a 100644 --- a/test/moment/days_in_month.js +++ b/test/moment/days_in_month.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.days_in_month = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "days in month" : function (test) { test.expect(24); var months = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], i; diff --git a/test/moment/diff.js b/test/moment/diff.js index ea12d7820..649518e44 100644 --- a/test/moment/diff.js +++ b/test/moment/diff.js @@ -33,6 +33,13 @@ function dstForYear(year) { } exports.diff = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "diff" : function (test) { test.expect(5); diff --git a/test/moment/duration.js b/test/moment/duration.js index e0377054e..084a3db3c 100644 --- a/test/moment/duration.js +++ b/test/moment/duration.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.duration = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "object instantiation" : function (test) { var d = moment.duration({ years: 2, diff --git a/test/moment/format.js b/test/moment/format.js index e855719e8..48fae9ca3 100644 --- a/test/moment/format.js +++ b/test/moment/format.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.format = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "format YY" : function (test) { test.expect(1); diff --git a/test/moment/getters_setters.js b/test/moment/getters_setters.js index 62c25ef0b..fb631e1cd 100644 --- a/test/moment/getters_setters.js +++ b/test/moment/getters_setters.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.getters_setters = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "getters" : function (test) { test.expect(8); diff --git a/test/moment/invalid.js b/test/moment/invalid.js index 494a4890d..fffefcc48 100644 --- a/test/moment/invalid.js +++ b/test/moment/invalid.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.invalid = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "invalid" : function (test) { var m = moment.invalid(); test.equals(m.isValid(), false); diff --git a/test/moment/is_after.js b/test/moment/is_after.js index 7991132b4..7eae5e36b 100644 --- a/test/moment/is_after.js +++ b/test/moment/is_after.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.is_after = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "is after without units" : function (test) { test.expect(17); diff --git a/test/moment/is_before.js b/test/moment/is_before.js index c3b0a4fe7..3e932d790 100644 --- a/test/moment/is_before.js +++ b/test/moment/is_before.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.is_before = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "is after without units" : function (test) { test.expect(17); diff --git a/test/moment/is_moment.js b/test/moment/is_moment.js index b73521b29..f57f9ff80 100644 --- a/test/moment/is_moment.js +++ b/test/moment/is_moment.js @@ -1,6 +1,13 @@ var moment = require('../../moment'); exports.is_moment = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "is moment object": function (test) { test.expect(13); diff --git a/test/moment/is_same.js b/test/moment/is_same.js index 961138279..0f4bd7270 100644 --- a/test/moment/is_same.js +++ b/test/moment/is_same.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.is_same = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "is same without units" : function (test) { test.expect(17); diff --git a/test/moment/is_valid.js b/test/moment/is_valid.js index 728a2b949..410bd69d5 100644 --- a/test/moment/is_valid.js +++ b/test/moment/is_valid.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.is_valid = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "array bad month" : function (test) { test.expect(2); test.equal(moment([2010, -1]).isValid(), false, 'month -1 invalid'); diff --git a/test/moment/lang.js b/test/moment/lang.js index c624fc199..405b1a2aa 100644 --- a/test/moment/lang.js +++ b/test/moment/lang.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.lang = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "library getter" : function (test) { var r; test.expect(8); diff --git a/test/moment/leapyear.js b/test/moment/leapyear.js index 84d67abae..47a48a4e1 100644 --- a/test/moment/leapyear.js +++ b/test/moment/leapyear.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.leapyear = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "leap year" : function (test) { test.expect(4); diff --git a/test/moment/listers.js b/test/moment/listers.js index 86fbbd2d2..fa0b969c5 100644 --- a/test/moment/listers.js +++ b/test/moment/listers.js @@ -3,6 +3,10 @@ var moment = require("../../moment"); exports.listers = { setUp : function (cb) { moment.lang('en'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + cb(); }, diff --git a/test/moment/min_max.js b/test/moment/min_max.js index 5f74bc7b9..e71da0a89 100644 --- a/test/moment/min_max.js +++ b/test/moment/min_max.js @@ -7,6 +7,9 @@ var equalMoment = function (test, a, b, msg) { exports.min_max = { setUp : function (cb) { moment.lang('en'); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; cb(); }, diff --git a/test/moment/mutable.js b/test/moment/mutable.js index ea46b937f..e2934c1ef 100644 --- a/test/moment/mutable.js +++ b/test/moment/mutable.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.mutable = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "manipulation methods" : function (test) { var mutableMethods = { diff --git a/test/moment/normalizeUnits.js b/test/moment/normalizeUnits.js index 0982127c9..25238b99d 100644 --- a/test/moment/normalizeUnits.js +++ b/test/moment/normalizeUnits.js @@ -3,6 +3,13 @@ var moment = require("../../moment"); exports.normalizeUnits = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "normalize units" : function (test) { var fullKeys = ["year", "month", "isoWeek", "week", "day", "hour", "minute", "second", "millisecond", "date", 'dayOfYear', 'weekday', 'isoWeekday', 'weekYear', 'isoWeekYear'], aliases = ["y", "M", "W", "w", "d", "h", "m", "s", "ms", "D", 'DDD', 'e', 'E', 'gg', 'GG'], diff --git a/test/moment/parsing_flags.js b/test/moment/parsing_flags.js index 180db693d..bac76eb30 100644 --- a/test/moment/parsing_flags.js +++ b/test/moment/parsing_flags.js @@ -4,6 +4,13 @@ var moment = require('../../moment'), }; exports.parsing_flags = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + 'overflow with array' : function (test) { diff --git a/test/moment/preparse_postformat.js b/test/moment/preparse_postformat.js index b7dd8f1ce..a8d1c3a76 100644 --- a/test/moment/preparse_postformat.js +++ b/test/moment/preparse_postformat.js @@ -44,6 +44,10 @@ var symbolLang = { exports.preparse_postformat = { setUp: function (cb) { moment.lang('symbol', symbolLang); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + cb(); }, diff --git a/test/moment/quarter.js b/test/moment/quarter.js index a98de1baa..cf3e3fe75 100644 --- a/test/moment/quarter.js +++ b/test/moment/quarter.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.quarter = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "library quarter" : function (test) { test.expect(7); diff --git a/test/moment/sod_eod.js b/test/moment/sod_eod.js index 17b928956..b886c6205 100644 --- a/test/moment/sod_eod.js +++ b/test/moment/sod_eod.js @@ -1,9 +1,12 @@ var moment = require("../../moment"); exports.end_start_of = { - setUp : function (cb) { + setUp : function (done) { moment.lang('en'); - cb(); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); }, tearDown : function (cb) { diff --git a/test/moment/string_prototype.js b/test/moment/string_prototype.js index 07cde9ca9..729404e89 100644 --- a/test/moment/string_prototype.js +++ b/test/moment/string_prototype.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.string_prototype = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "string prototype overrides call" : function (test) { test.expect(1); diff --git a/test/moment/utc.js b/test/moment/utc.js index 09c2de1a5..29f75cf13 100644 --- a/test/moment/utc.js +++ b/test/moment/utc.js @@ -1,9 +1,13 @@ var moment = require("../../moment"); exports.utc = { - setUp : function (cb) { + setUp : function (done) { moment.lang('en'); - cb(); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + + done(); }, tearDown : function (cb) { diff --git a/test/moment/week_year.js b/test/moment/week_year.js index 345c3862c..132d6c05b 100644 --- a/test/moment/week_year.js +++ b/test/moment/week_year.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.week_year = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "iso week year": function (test) { test.expect(19); diff --git a/test/moment/weekday.js b/test/moment/weekday.js index a6eb6de67..c7b8a7201 100644 --- a/test/moment/weekday.js +++ b/test/moment/weekday.js @@ -1,6 +1,13 @@ var moment = require("../../moment"); exports.week_year = { + setUp : function (done) { + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + done(); + }, + "iso weekday": function (test) { var i; test.expect(7 * 7); diff --git a/test/moment/weeks.js b/test/moment/weeks.js index 272f49de6..64b29b756 100644 --- a/test/moment/weeks.js +++ b/test/moment/weeks.js @@ -1,9 +1,13 @@ var moment = require("../../moment"); exports.weeks = { - setUp : function (cb) { + setUp : function (done) { moment.lang('en'); - cb(); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + + done(); }, tearDown : function (cb) { diff --git a/test/moment/zones.js b/test/moment/zones.js index cd203f632..7b673d066 100644 --- a/test/moment/zones.js +++ b/test/moment/zones.js @@ -1,9 +1,13 @@ var moment = require("../../moment"); exports.zones = { - setUp : function (cb) { + setUp : function (done) { moment.lang('en'); - cb(); + moment.createFromInputFallback = function () { + throw new Error("input not handled by moment"); + }; + + done(); }, tearDown : function (cb) { -- 2.47.2