Unit Tests

- All tests that sleep will now announce the duration of the sleep
  beforehand.
This commit is contained in:
Paul Beckingham 2010-08-07 00:22:05 -04:00
parent 6dd4067167
commit 80d1c03457
9 changed files with 36 additions and 15 deletions

View file

@ -50,6 +50,7 @@ qx{../task rc:annotate.rc add two};
qx{../task rc:annotate.rc add three};
qx{../task rc:annotate.rc add four};
qx{../task rc:annotate.rc annotate 1 foo1};
diag ("5 second delay");
sleep 1;
qx{../task rc:annotate.rc annotate 1 foo2};
sleep 1;

View file

@ -46,6 +46,7 @@ if (open my $fh, '>', 'bug.rc')
# Ensure the two tasks have a 1 second delta in entry.
qx{../task rc:bug.rc add older};
diag ("1 second delay");
sleep 1;
qx{../task rc:bug.rc add newer};
@ -57,6 +58,7 @@ like ($output, qr/newer.+older/ms, 'sort:entry- -> newer older');
# Ensure the two tasks have a 1 second delta in start.
qx{../task rc:bug.rc start 1};
diag ("1 second delay");
sleep 1;
qx{../task rc:bug.rc start 2};
@ -68,6 +70,7 @@ like ($output, qr/newer.+older/ms, 'sort:start- -> newer older');
# Ensure the two tasks have a 1 second delta in end.
qx{../task rc:bug.rc done 1};
diag ("1 second delay");
sleep 1;
qx{../task rc:bug.rc done 2};

View file

@ -50,7 +50,8 @@ qx{../task rc:hasnt.rc 2 annotate bar};
# 3
qx{../task rc:hasnt.rc add foo};
qx{../task rc:hasnt.rc 3 annotate bar};
sleep 2;
diag ("3 second delay");
sleep 1;
qx{../task rc:hasnt.rc 3 annotate baz};
# 4
@ -63,13 +64,13 @@ qx{../task rc:hasnt.rc 5 annotate foo};
# 6
qx{../task rc:hasnt.rc add bar};
qx{../task rc:hasnt.rc 6 annotate foo};
sleep 2;
sleep 1;
qx{../task rc:hasnt.rc 6 annotate baz};
#7
qx{../task rc:hasnt.rc add one};
qx{../task rc:hasnt.rc 7 annotate two};
sleep 2;
sleep 1;
qx{../task rc:hasnt.rc 7 annotate three};
my $output = qx{../task rc:hasnt.rc ls description.has:foo};

View file

@ -47,6 +47,7 @@ if (open my $fh, '>', 'denotate.rc')
# Add four tasks, annotate one three times, one twice, one just once and one none.
qx{../task rc:denotate.rc add one};
qx{../task rc:denotate.rc annotate 1 Ernie};
diag ("6 second delay");
sleep 1;
qx{../task rc:denotate.rc annotate 1 Bert};
sleep 1;

View file

@ -55,6 +55,7 @@ my $output = qx{../task rc:hook.rc version};
if ($output =~ /PUC-Rio/)
{
qx{../task rc:hook.rc add foo};
diag ("1 second delay");
sleep 1;
$output = qx{../task rc:hook.rc list};

View file

@ -56,6 +56,7 @@ my $output = qx{../task rc:hook.rc version};
if ($output =~ /PUC-Rio/)
{
qx{../task rc:hook.rc add foo};
diag ("1 second delay");
sleep 1;
$output = qx{../task rc:hook.rc list};

View file

@ -69,6 +69,7 @@ if (open my $fh, '>', 'remote.rc')
# Create some basic tasks on both sides
qx{../task rc:local.rc add left_modified};
diag ("25 second delay");
sleep(1);
qx{../task rc:local.rc add right_modified};
sleep(1);

View file

@ -39,10 +39,13 @@ if (open my $fh, '>', 'oldest.rc')
}
# Add 11 tasks. Oldest should show 1-10, newest should show 2-11.
diag ("Adding 3 tasks - takes 2 seconds");
qx{../task rc:oldest.rc add one; sleep 1};
qx{../task rc:oldest.rc add two; sleep 1};
qx{../task rc:oldest.rc add three; sleep 1};
qx{../task rc:oldest.rc add one};
diag ("3 second delay");
sleep 1;
qx{../task rc:oldest.rc add two};
sleep 1;
qx{../task rc:oldest.rc add three};
sleep 1;
my $output = qx{../task rc:oldest.rc oldest};
like ($output, qr/one/, 'oldest: one');
like ($output, qr/two/, 'oldest: two');
@ -55,14 +58,21 @@ like ($output, qr/two/, 'newest: two');
like ($output, qr/one/, 'newest: one');
like ($output, qr/three.*two.*one/ms, 'newest: sort');
diag ("Adding 8 tasks - takes 7 seconds");
qx{../task rc:oldest.rc add four; sleep 1};
qx{../task rc:oldest.rc add five; sleep 1};
qx{../task rc:oldest.rc add six; sleep 1};
qx{../task rc:oldest.rc add seven; sleep 1};
qx{../task rc:oldest.rc add eight; sleep 1};
qx{../task rc:oldest.rc add nine; sleep 1};
qx{../task rc:oldest.rc add ten; sleep 1};
qx{../task rc:oldest.rc add four};
diag ("7 second delay");
sleep 1;
qx{../task rc:oldest.rc add five};
sleep 1;
qx{../task rc:oldest.rc add six};
sleep 1;
qx{../task rc:oldest.rc add seven};
sleep 1;
qx{../task rc:oldest.rc add eight};
sleep 1;
qx{../task rc:oldest.rc add nine};
sleep 1;
qx{../task rc:oldest.rc add ten};
sleep 1;
qx{../task rc:oldest.rc add eleven};
$output = qx{../task rc:oldest.rc oldest};

View file

@ -48,6 +48,7 @@ my $output = qx{../task rc:wait.rc ls};
like ($output, qr/nowait/ms, 'non-waiting task visible');
unlike ($output, qr/yeswait/ms, 'waiting task invisible');
diag ("3 second delay");
sleep 3;
$output = qx{../task rc:wait.rc ls};
@ -59,6 +60,7 @@ $output = qx{../task rc:wait.rc ls};
like ($output, qr/nowait/ms, 'non-waiting task visible');
unlike ($output, qr/yeswait/ms, 'waiting task invisible');
diag ("3 second delay");
sleep 3;
$output = qx{../task rc:wait.rc ls};