Unit Tests

- Fixed unit tests that broke because the unit test script took more
  than one second to run.  Ordinarily is a test script does this:

    $ task add foo
    $ task list

  Then the age of the task is listed as '-', which means under one
  second.  But if the test does this:

    $ task add foo
    $ sleep 1
    $ task list

  Then the age is listed as '1 sec'.  Sometimes, as in these tests,
  the host may be just slow enough that the test script expects '-',
  but gets '1 sec'.
This commit is contained in:
Paul Beckingham 2010-04-04 10:00:01 -04:00
parent a3a941fd92
commit d6251142a2

View file

@ -57,16 +57,16 @@ if (open my $fh, '>', 'annual.rc')
qx{../task rc:annual.rc add foo due:1/1/2000 recur:annual until:1/1/2009};
my $output = qx{../task rc:annual.rc list};
like ($output, qr/2\s+1\/1\/2000\s+-\s+foo/, 'synthetic 1 no creep');
like ($output, qr/3\s+1\/1\/2001\s+-\s+foo/, 'synthetic 2 no creep');
like ($output, qr/4\s+1\/1\/2002\s+-\s+foo/, 'synthetic 3 no creep');
like ($output, qr/5\s+1\/1\/2003\s+-\s+foo/, 'synthetic 4 no creep');
like ($output, qr/6\s+1\/1\/2004\s+-\s+foo/, 'synthetic 5 no creep');
like ($output, qr/7\s+1\/1\/2005\s+-\s+foo/, 'synthetic 6 no creep');
like ($output, qr/8\s+1\/1\/2006\s+-\s+foo/, 'synthetic 7 no creep');
like ($output, qr/9\s+1\/1\/2007\s+-\s+foo/, 'synthetic 8 no creep');
like ($output, qr/10\s+1\/1\/2008\s+-\s+foo/, 'synthetic 9 no creep');
like ($output, qr/11\s+1\/1\/2009\s+-\s+foo/, 'synthetic 10 no creep');
like ($output, qr/2\s+1\/1\/2000\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 1 no creep');
like ($output, qr/3\s+1\/1\/2001\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 2 no creep');
like ($output, qr/4\s+1\/1\/2002\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 3 no creep');
like ($output, qr/5\s+1\/1\/2003\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 4 no creep');
like ($output, qr/6\s+1\/1\/2004\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 5 no creep');
like ($output, qr/7\s+1\/1\/2005\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 6 no creep');
like ($output, qr/8\s+1\/1\/2006\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 7 no creep');
like ($output, qr/9\s+1\/1\/2007\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 8 no creep');
like ($output, qr/10\s+1\/1\/2008\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 9 no creep');
like ($output, qr/11\s+1\/1\/2009\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 10 no creep');
# Cleanup.
unlink 'pending.data';