From: Nicholas Bollweg Date: Wed, 14 Aug 2013 14:04:54 +0000 (-0400) Subject: testing negative iso duration X-Git-Tag: 2.3.0~10^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb0b4d77be46bba9bd99af50449cb7605512015c;p=thirdparty%2Fmoment.git testing negative iso duration --- diff --git a/test/moment/duration.js b/test/moment/duration.js index 29cfbf557..5d2953d95 100644 --- a/test/moment/duration.js +++ b/test/moment/duration.js @@ -199,13 +199,14 @@ exports.duration = { }, "instatiation from iso 8601 duration" : function (test) { - test.expect(6); - test.equal(moment.duration('P1Y2M3DT4H5M6S').asSeconds(), moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).asSeconds(), "all fields"); - test.equal(moment.duration('P1W').asSeconds(), moment.duration({d: 7}).asSeconds(), "week field"); - test.equal(moment.duration('P1M').asSeconds(), moment.duration({M: 1}).asSeconds(), "single month field"); - test.equal(moment.duration('PT1M').asSeconds(), moment.duration({m: 1}).asSeconds(), "single minute field"); - test.equal(moment.duration('P1MT2H').asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), "random fields missing"); - test.equal(moment.duration('PY1MDT2HMS').asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), "random values missing"); + test.expect(7); + test.equal(moment.duration("P1Y2M3DT4H5M6S").asSeconds(), moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).asSeconds(), "all fields"); + test.equal(moment.duration("P1W").asSeconds(), moment.duration({d: 7}).asSeconds(), "week field"); + test.equal(moment.duration("P1M").asSeconds(), moment.duration({M: 1}).asSeconds(), "single month field"); + test.equal(moment.duration("PT1M").asSeconds(), moment.duration({m: 1}).asSeconds(), "single minute field"); + test.equal(moment.duration("P1MT2H").asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), "random fields missing"); + test.equal(moment.duration("PY1MDT2HMS").asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), "random values missing"); + test.equal(moment.duration("-P60D").asSeconds(), moment.duration({d: -60}).asSeconds(), "negative days"); test.done(); },