graphicore / ufoJS

Javascript API for the Unified Font Object
lib.ufojs.org
GNU General Public License v3.0
52 stars 10 forks source link

Test time fail #3

Closed Troush closed 9 years ago

Troush commented 10 years ago

PASSED test: Test_isInt 0 ms _AssertFailure: doh._AssertFailure: assertEqual() failed: expected Sun Feb 05 2012 05:11:40 GMT+0100 (CET) but got Sun Feb 05 2012 06:11:40 GMT+0200 (EET)

<<< doh._AssertFailure stack> doh._AssertFailure at Object.d as runnerFactory at /home/troush/Work/ufoJS/env/javascript/tests-node.js:26:15 at Object.context.execCb (/home/troush/Work/ufoJS/env/javascript/r.js:1764:33) at Object.Module.check (/home/troush/Work/ufoJS/env/javascript/r.js:1073:51) at Object.Module.enable (/home/troush/Work/ufoJS/env/javascript/r.js:1314:22) at Object.Module.init (/home/troush/Work/ufoJS/env/javascript/r.js:972:26) at Object.context.require (/home/troush/Work/ufoJS/env/javascript/r.js:1569:28) at requirejs (/home/troush/Work/ufoJS/env/javascript/r.js:1848:24) at /home/troush/Work/ufoJS/env/javascript/tests-node.js:2:1 at /home/troush/Work/ufoJS/env/javascript/tests-node.js:66:2 <stack ERROR IN: function Test_parseDate() { //This are not really in depth tests of the function. Anyone?

    var expected = Date.parse('Fri Oct 14 2011 00:21:40 GMT+0200 (CEST)');
        result = main.parseDate('2011-10-13T22:21:40.000Z');
    doh.assertEqual(expected, result);

    //see if the fallback to standart parsing works, too
    var dateJS = 'Fri Oct 14 2011 00:21:40 GMT+0200 (CEST)',
        expected = Date.parse(dateJS);
        result = main.parseDate(dateJS);
    doh.assertEqual(expected, result);

    // actually this passes but is rather an implementation specific
    // detail. the timestamp is generated with Date.UTC() which can do
    // date arithmetic things i.e. the 13. month is the first month of
    // next year. Is this expected from a dateparsing function???
    // if yes we must test it.
    var expected = 'Sun Feb 05 2012 05:11:40 GMT+0100 (CET)',
        result = (new Date(main.parseDate('2011-13-35T27:71:40.000Z'))).toString();
    doh.assertEqual(expected, result);

    var result = new Date(main.parseDate('This is no date at all.'));
    doh.assertTrue(isNaN(result.getTime()));
}