Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5884 closed defect (fixed)

test_date_add UT failure

Reported by: Adam Peller Owned by: Bryan Forbes
Priority: high Milestone: 1.1
Component: Date Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description

noticed when #5200 was fixed:

GROUP "tests.date.math" has 12 tests to run
 PASSED test: test_date_compare
     _AssertFailure: file:///users/peller/Sites/workspace/trunk4/dojo/_base/_loader/bootstrap.js:345 doh._AssertFailure: assertEqual() failed: expected |Sun Oct 28 2001 01:00:00 GMT-0500 (EST)| but got |Sun Oct 28 2001 01:00:00 GMT-0400 (EDT)|
 doh._AssertFailure
     ERROR IN:
  (function test_date_add(t) {var interv = "";var dtA = null;var dtB = null;interv = "year";dtA = new Date(2005, 11, 27);dtB = new Date(2006, 11, 27);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2005, 11, 27);dtB = new Date(2004, 11, 27);t.is(dtB, dojo.date.add(dtA, interv, -1));dtA = new Date(2000, 1, 29);dtB = new Date(2001, 1, 28);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 1, 29);dtB = new Date(2005, 1, 28);t.is(dtB, dojo.date.add(dtA, interv, 5));dtA = new Date(1900, 11, 31);dtB = new Date(1930, 11, 31);t.is(dtB, dojo.date.add(dtA, interv, 30));dtA = new Date(1995, 11, 31);dtB = new Date(2030, 11, 31);t.is(dtB, dojo.date.add(dtA, interv, 35));interv = "quarter";dtA = new Date(2000, 0, 1);dtB = new Date(2000, 3, 1);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 1, 29);dtB = new Date(2000, 7, 29);t.is(dtB, dojo.date.add(dtA, interv, 2));dtA = new Date(2000, 1, 29);dtB = new Date(2001, 1, 28);t.is(dtB, dojo.date.add(dtA, interv, 4));interv = "month";dtA = new Date(2000, 0, 1);dtB = new Date(2000, 1, 1);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 0, 31);dtB = new Date(2000, 1, 29);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 1, 29);dtB = new Date(2001, 1, 28);t.is(dtB, dojo.date.add(dtA, interv, 12));interv = "week";dtA = new Date(2000, 0, 1);dtB = new Date(2000, 0, 8);t.is(dtB, dojo.date.add(dtA, interv, 1));interv = "day";dtA = new Date(2000, 0, 1);dtB = new Date(2000, 0, 2);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2001, 0, 1);dtB = new Date(2002, 0, 1);t.is(dtB, dojo.date.add(dtA, interv, 365));dtA = new Date(2000, 0, 1);dtB = new Date(2001, 0, 1);t.is(dtB, dojo.date.add(dtA, interv, 366));dtA = new Date(2000, 1, 28);dtB = new Date(2000, 1, 29);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2001, 1, 28);dtB = new Date(2001, 2, 1);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 2, 1);dtB = new Date(2000, 1, 29);t.is(dtB, dojo.date.add(dtA, interv, -1));dtA = new Date(2001, 2, 1);dtB = new Date(2001, 1, 28);t.is(dtB, dojo.date.add(dtA, interv, -1));dtA = new Date(2000, 0, 1);dtB = new Date(1999, 11, 31);t.is(dtB, dojo.date.add(dtA, interv, -1));interv = "weekday";dtA = new Date(2000, 0, 1);dtB = new Date(2000, 0, 3);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 0, 2);dtB = new Date(2000, 0, 3);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 0, 2);dtB = new Date(2000, 0, 7);t.is(dtB, dojo.date.add(dtA, interv, 5));dtA = new Date(2000, 0, 2);dtB = new Date(2000, 0, 10);t.is(dtB, dojo.date.add(dtA, interv, 6));dtA = new Date(2000, 0, 3);dtB = new Date(2000, 0, 17);t.is(dtB, dojo.date.add(dtA, interv, 10));dtA = new Date(2000, 0, 8);dtB = new Date(2000, 0, 3);t.is(dtB, dojo.date.add(dtA, interv, -5));dtA = new Date(2000, 0, 9);dtB = new Date(2000, 0, 5);t.is(dtB, dojo.date.add(dtA, interv, -3));dtA = new Date(2000, 0, 23);dtB = new Date(2000, 0, 7);t.is(dtB, dojo.date.add(dtA, interv, -11));interv = "hour";dtA = new Date(2000, 0, 1, 11);dtB = new Date(2000, 0, 1, 12);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2001, 9, 28, 0);dtB = new Date(2001, 9, 28, 1);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2001, 9, 28, 23);dtB = new Date(2001, 9, 29, 0);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2001, 11, 31, 23);dtB = new Date(2002, 0, 1, 0);t.is(dtB, dojo.date.add(dtA, interv, 1));interv = "minute";dtA = new Date(2000, 11, 31, 23, 59);dtB = new Date(2001, 0, 1, 0, 0);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 11, 27, 12, 2);dtB = new Date(2000, 11, 27, 13, 2);t.is(dtB, dojo.date.add(dtA, interv, 60));interv = "second";dtA = new Date(2000, 11, 31, 23, 59, 59);dtB = new Date(2001, 0, 1, 0, 0, 0);t.is(dtB, dojo.date.add(dtA, interv, 1));dtA = new Date(2000, 11, 27, 8, 10, 59);dtB = new Date(2000, 11, 27, 8, 11, 59);t.is(dtB, dojo.date.add(dtA, interv, 60));})
 FAILED test: test_date_add

Change History (3)

comment:1 Changed 11 years ago by Adam Peller

Owner: changed from Adam Peller to Bryan Forbes

Bryan, know you love these :)

comment:2 Changed 11 years ago by Bryan Forbes

Resolution: fixed
Status: newclosed

(In [13037]) fixes #5884.

  • Because of daylight savings time, changed one of the hour add tests to add an actual hour of milliseconds to the start date to get the target date.

comment:3 Changed 11 years ago by Bryan Forbes

(In [13038]) refs #5884.

  • bzr-svn added some bzr: props to the trunk of dojo. Removing.
Note: See TracTickets for help on using tickets.