From a76614aabb2722edb9147dbbb4ee9d79efb8c7cd Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 11 Jun 2014 06:28:56 -0400 Subject: [PATCH] Unit Tests - Removed obsolete tests. --- test/bug.987.x | 70 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/test/bug.987.x b/test/bug.987.x index 56ecb5751..23d360772 100755 --- a/test/bug.987.x +++ b/test/bug.987.x @@ -27,15 +27,22 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 7; + +# Ensure environment has no influence. +delete $ENV{'TASKDATA'}; +delete $ENV{'TASKRC'}; + +use File::Basename; +my $ut = basename ($0); +my $rc = $ut . '.rc'; # Create the rc file. -if (open my $fh, '>', 'bug.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n", "confirmation=off\n"; close $fh; - ok (-r 'bug.rc', 'Created bug.rc'); } # Bug 987 - 'Total active time' is still increasing when a task is done @@ -44,78 +51,71 @@ if (open my $fh, '>', 'bug.rc') # constant: # - start (a), stop (o), done (d) and none (n) # (none disallows the name of each task to be the prefix of any other) -qx{../src/task rc:bug.rc add test_aodn}; -qx{../src/task rc:bug.rc test_aodn start}; -qx{faketime -f '+1s' ../src/task rc:bug.rc test_aodn stop}; -qx{faketime -f '+2s' ../src/task rc:bug.rc test_aodn done}; +qx{../src/task rc:$rc add test_aodn}; +qx{../src/task rc:$rc test_aodn start}; +qx{faketime -f '+1s' ../src/task rc:$rc test_aodn stop}; +qx{faketime -f '+2s' ../src/task rc:$rc test_aodn done}; check_constant_close_zero("test_aodn"); # - start and done -qx{../src/task rc:bug.rc add test_adn}; -qx{../src/task rc:bug.rc test_adn start}; -qx{faketime -f '+1s' ../src/task rc:bug.rc test_adn done}; +qx{../src/task rc:$rc add test_adn}; +qx{../src/task rc:$rc test_adn start}; +qx{faketime -f '+1s' ../src/task rc:$rc test_adn done}; check_constant_close_zero("test_adn"); # - start, done and stop -qx{../src/task rc:bug.rc add test_adon}; -qx{../src/task rc:bug.rc test_adon start}; -qx{faketime -f '+1s' ../src/task rc:bug.rc test_adon done}; -qx{faketime -f '+2s' ../src/task rc:bug.rc test_adon stop}; +qx{../src/task rc:$rc add test_adon}; +qx{../src/task rc:$rc test_adon start}; +qx{faketime -f '+1s' ../src/task rc:$rc test_adon done}; +qx{faketime -f '+2s' ../src/task rc:$rc test_adon stop}; check_constant_close_zero("test_adon"); # - done, start and stop (XXX whether this should be allowed is questionable) -qx{../src/task rc:bug.rc add test_daon}; -qx{../src/task rc:bug.rc test_daon done}; -qx{faketime -f '+1s' ../src/task rc:bug.rc test_daon start}; -qx{faketime -f '+2s' ../src/task rc:bug.rc test_daon stop}; +qx{../src/task rc:$rc add test_daon}; +qx{../src/task rc:$rc test_daon done}; +qx{faketime -f '+1s' ../src/task rc:$rc test_daon start}; +qx{faketime -f '+2s' ../src/task rc:$rc test_daon stop}; check_constant_close_zero("test_daon"); # Test all cases for which the active duration must not be shown: # - done -qx{../src/task rc:bug.rc add test_dn}; -qx{../src/task rc:bug.rc test_dn done}; +qx{../src/task rc:$rc add test_dn}; +qx{../src/task rc:$rc test_dn done}; check_no_summary("test_dn"); # Test all case for which the active duration must be close to zero and # increasing: # - start -qx{../src/task rc:bug.rc add test_sn}; -qx{../src/task rc:bug.rc test_sn start}; +qx{../src/task rc:$rc add test_sn}; +qx{../src/task rc:$rc test_sn start}; check_running_close_zero("test_sn"); # - done and start (XXX whether this should be allowed is questionable) -qx{../src/task rc:bug.rc add test_dsn}; -qx{../src/task rc:bug.rc test_dsn start}; +qx{../src/task rc:$rc add test_dsn}; +qx{../src/task rc:$rc test_dsn start}; check_running_close_zero("test_dsn"); -### Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data bug.rc); -ok (! -r 'pending.data' && - ! -r 'completed.data' && - ! -r 'undo.data' && - ! -r 'backlog.data' && - ! -r 'bug.rc', 'Cleanup'); - +unlink qw(pending.data completed.data undo.data backlog.data), $rc; exit 0; ################################################################################ # Check that the active time is not above one minute after waiting for one minute sub check_constant_close_zero { my ($task) = @_; - my $output = qx{faketime -f '+60s' ../src/task rc:bug.rc $task info}; + my $output = qx{faketime -f '+60s' ../src/task rc:$rc $task info}; like ($output, qr/Total active time 0:00:/ms, 'Total active duration is not increasing and is close to zeo'); } # Check that there is no active time summary sub check_no_summary { my ($task) = @_; - my $output = qx{faketime -f '+10s' ../src/task rc:bug.rc $task info}; + my $output = qx{faketime -f '+10s' ../src/task rc:$rc $task info}; unlike ($output, qr/Total active time/ms, 'No total active duration summary'); } # Check that the active time is above one minute after waiting for one minute sub check_running_close_zero { my ($task) = @_; - my $output = qx{faketime -f '+60s' ../src/task rc:bug.rc $task info}; + my $output = qx{faketime -f '+60s' ../src/task rc:$rc $task info}; like ($output, qr/Total active time 0:01:/ms, 'Total active duration is increasing and is close to zero'); }