diff -r 000000000000 -r 6474c204b198 intl/locale/tests/unit/test_bug371611.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/intl/locale/tests/unit/test_bug371611.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,26 @@ +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cr = Components.results; + +function test_formatdatetime_return() +{ + var dateConv = Cc["@mozilla.org/intl/scriptabledateformat;1"]. + getService(Ci.nsIScriptableDateFormat); + + /* Testing if we throw instead of crashing when we are passed 0s. */ + var x = false; + try { + dateConv.FormatDate("", Ci.nsIScriptableDateFormat.dateFormatLong, + 0, 0, 0); + } + catch (e if (e.result == Cr.NS_ERROR_INVALID_ARG)) { + x = true; + } + if (!x) + do_throw("FormatDate didn't throw when passed 0 for its arguments."); +} + +function run_test() +{ + test_formatdatetime_return(); +}