mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests
- Improved args.5.t, which was attempting to stop tasks that were not started.
This commit is contained in:
parent
d5849b0160
commit
8e0296468e
4 changed files with 18 additions and 3 deletions
10
src/Task.cpp
10
src/Task.cpp
|
@ -150,6 +150,16 @@ void Task::setEnd ()
|
|||
recalc_urgency = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::setStart ()
|
||||
{
|
||||
char startTime[16];
|
||||
sprintf (startTime, "%u", (unsigned int) time (NULL));
|
||||
set ("start", startTime);
|
||||
|
||||
recalc_urgency = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Task::status Task::getStatus () const
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
void setEntry ();
|
||||
void setEnd ();
|
||||
void setStart ();
|
||||
|
||||
status getStatus () const;
|
||||
void setStatus (status);
|
||||
|
|
|
@ -87,9 +87,7 @@ int CmdStart::execute (std::string& output)
|
|||
apply_defaults (*task);
|
||||
|
||||
// Add a start time.
|
||||
char startTime[16];
|
||||
sprintf (startTime, "%u", (unsigned int) time (NULL));
|
||||
task->set ("start", startTime);
|
||||
task->setStart ();
|
||||
|
||||
if (context.config.getBoolean ("journal.time"))
|
||||
task->addAnnotation (context.config.get ("journal.time.start.annotation"));
|
||||
|
|
|
@ -46,6 +46,12 @@ qx{../src/task rc:args.rc add three};
|
|||
qx{../src/task rc:args.rc add four};
|
||||
qx{../src/task rc:args.rc add five};
|
||||
|
||||
qx{../src/task rc:args.rc 1 start};
|
||||
qx{../src/task rc:args.rc 2 start};
|
||||
qx{../src/task rc:args.rc 3 start};
|
||||
qx{../src/task rc:args.rc 4 start};
|
||||
qx{../src/task rc:args.rc 5 start};
|
||||
|
||||
qx{../src/task rc:args.rc 1 stop oneanno};
|
||||
my $output = qx{../src/task rc:args.rc 1 info};
|
||||
like ($output, qr/oneanno/, 'stop enpassant anno');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue