Enhancement

- Output error, header, footnote and debug messages on standard error.
This commit is contained in:
Louis-Claude Canon 2012-06-15 21:16:06 +02:00 committed by Paul Beckingham
parent b093d23f1f
commit b45a305df2
28 changed files with 101 additions and 82 deletions

View file

@ -31,6 +31,7 @@ Features
+ Possible to specify the date format when showing information about a task
with 'dateformat.info'.
+ Bash script improvement (column names are now completed).
+ Output error, header, footnote and debug messages on standard error.
Bugs
+ Applied patch for bug #919, so the holidays listed on the 'calendar' report

View file

@ -273,6 +273,9 @@ Here are the shortcut equivalents:
verbose=nothing
verbose=
Those additional comments are sent to the standard error for header, footnote
and project. The others are sent to standard output.
.TP
.B confirmation=yes
May be "yes" or "no", and determines whether taskwarrior will ask for

View file

@ -208,9 +208,9 @@ int Context::initialize (int argc, const char** argv)
std::vector <std::string>::iterator d;
for (d = debugMessages.begin (); d != debugMessages.end (); ++d)
if (color ())
std::cout << colorizeDebug (*d) << "\n";
std::cerr << colorizeDebug (*d) << "\n";
else
std::cout << *d << "\n";
std::cerr << *d << "\n";
}
// Dump all headers, controlled by 'header' verbosity token.
@ -219,9 +219,9 @@ int Context::initialize (int argc, const char** argv)
std::vector <std::string>::iterator h;
for (h = headers.begin (); h != headers.end (); ++h)
if (color ())
std::cout << colorizeHeader (*h) << "\n";
std::cerr << colorizeHeader (*h) << "\n";
else
std::cout << *h << "\n";
std::cerr << *h << "\n";
}
// Dump all footnotes, controlled by 'footnote' verbosity token.
@ -230,9 +230,9 @@ int Context::initialize (int argc, const char** argv)
std::vector <std::string>::iterator f;
for (f = footnotes.begin (); f != footnotes.end (); ++f)
if (color ())
std::cout << colorizeFootnote (*f) << "\n";
std::cerr << colorizeFootnote (*f) << "\n";
else
std::cout << *f << "\n";
std::cerr << *f << "\n";
}
// Dump all errors, non-maskable.
@ -242,9 +242,9 @@ int Context::initialize (int argc, const char** argv)
std::vector <std::string>::iterator e;
for (e = errors.begin (); e != errors.end (); ++e)
if (color ())
std::cout << colorizeFootnote (*e) << "\n";
std::cerr << colorizeFootnote (*e) << "\n";
else
std::cout << *e << "\n";
std::cerr << *e << "\n";
}
timer_init.stop ();
@ -311,9 +311,9 @@ int Context::run ()
std::vector <std::string>::iterator d;
for (d = debugMessages.begin (); d != debugMessages.end (); ++d)
if (color ())
std::cout << colorizeDebug (*d) << "\n";
std::cerr << colorizeDebug (*d) << "\n";
else
std::cout << *d << "\n";
std::cerr << *d << "\n";
}
// Dump all headers, controlled by 'header' verbosity token.
@ -322,9 +322,9 @@ int Context::run ()
std::vector <std::string>::iterator h;
for (h = headers.begin (); h != headers.end (); ++h)
if (color ())
std::cout << colorizeHeader (*h) << "\n";
std::cerr << colorizeHeader (*h) << "\n";
else
std::cout << *h << "\n";
std::cerr << *h << "\n";
}
// Dump the report output.
@ -336,9 +336,9 @@ int Context::run ()
std::vector <std::string>::iterator f;
for (f = footnotes.begin (); f != footnotes.end (); ++f)
if (color ())
std::cout << colorizeFootnote (*f) << "\n";
std::cerr << colorizeFootnote (*f) << "\n";
else
std::cout << *f << "\n";
std::cerr << *f << "\n";
}
// Dump all errors, non-maskable.
@ -346,9 +346,9 @@ int Context::run ()
std::vector <std::string>::iterator e;
for (e = errors.begin (); e != errors.end (); ++e)
if (color ())
std::cout << colorizeFootnote (*e) << "\n";
std::cerr << colorizeFootnote (*e) << "\n";
else
std::cout << *e << "\n";
std::cerr << *e << "\n";
hooks.trigger ("on-exit");
return rc;

View file

@ -51,9 +51,9 @@ extern Context context;
#define DEBUG_OUTPUT 0
#if DEBUG_OUTPUT > 0
#define DEBUG_STR(str) std::cout << "DEBUG: " << str << "\n"; std::cout.flush()
#define DEBUG_STR_PART(str) std::cout << "DEBUG: " << str; std::cout.flush()
#define DEBUG_STR_END(str) std::cout << str << "\n"; std::cout.flush()
#define DEBUG_STR(str) std::cerr << "DEBUG: " << str << "\n"; std::cerr.flush()
#define DEBUG_STR_PART(str) std::cerr << "DEBUG: " << str; std::cerr.flush()
#define DEBUG_STR_END(str) std::cerr << str << "\n"; std::cerr.flush()
#else
#define DEBUG_STR(str)
#define DEBUG_STR_PART(str)

View file

@ -147,7 +147,6 @@ int CmdCustom::execute (std::string& output)
if (maxlines)
maxlines -= (context.verbose ("blank") ? 1 : 0)
+ table_header
+ (context.verbose ("footnote") ? context.footnotes.size () : 0)
+ 1; // "X tasks shown ..."
// Render.
@ -161,6 +160,7 @@ int CmdCustom::execute (std::string& output)
<< view.render (filtered, sequence)
<< optionalBlankLine ();
// Print the number of rendered tasks
if (context.verbose ("affected"))
{
out << (filtered.size () == 1

View file

@ -691,7 +691,7 @@ ARE_THESE_REALLY_HARMFUL:
if (oops)
{
std::cout << STRING_ERROR_PREFIX << problem << "\n";
std::cerr << STRING_ERROR_PREFIX << problem << "\n";
// Preserve the edits.
before = after;

View file

@ -89,7 +89,22 @@ int CmdMerge::execute (std::string& output)
else
file = uri._path;
context.tdb2.merge (file);
// XXX the following function could indicate whether a modification was
// performed without an exception (by returning a boolean, within a status
// object or with a specific function)
try
{
context.tdb2.merge (file);
}
catch (std::string& e) {
if (e == STRING_TDB2_UP_TO_DATE)
{
output += e + "\n";
return 0;
}
else
throw e;
}
output += std::string (STRING_CMD_MERGE_COMPLETE) + "\n";

View file

@ -113,7 +113,7 @@ int CmdShell::execute (std::string&)
catch (std::string& error)
{
std::cout << error << "\n";
std::cerr << error << "\n";
}
catch (...)

View file

@ -76,7 +76,7 @@ int main (int argc, const char** argv)
catch (std::string& error)
{
std::cout << error << "\n";
std::cerr << error << "\n";
status = -1;
}

View file

@ -43,7 +43,7 @@ if (open my $fh, '>', 'basic.rc')
my $version = slurp ('../../configure.ac');
# Test the usage command.
my $output = qx{../src/task rc:basic.rc};
my $output = qx{../src/task rc:basic.rc 2>&1 >/dev/null};
like ($output, qr/You must specify a command or a task to modify./m, 'missing command and ID');
# Test the version command.

View file

@ -45,25 +45,25 @@ qx{../src/task rc:bug.rc ls};
# Result: trying to add the project generates an error about removing
# recurrence from a task.
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 modify project:bar};
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 modify project:bar 2>&1 >/dev/null};
unlike ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'No recurrence removal error');
# Now try to generate the error above via regular means - ie, is it actually
# doing what it should?
# TODO Removing recur: from a recurring task should also remove imask and parent.
$output = qx{../src/task rc:bug.rc 2 modify recur:};
$output = qx{../src/task rc:bug.rc 2 modify recur: 2>&1 >/dev/null};
like ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'Recurrence removal error');
# Prevent removal of the due date from a recurring task.
# TODO Removing due: from a recurring task should also remove recur, imask and parent
$output = qx{../src/task rc:bug.rc 2 modify due:};
$output = qx{../src/task rc:bug.rc 2 modify due: 2>&1 >/dev/null};
like ($output, qr/You cannot remove the due date from a recurring task./ms, 'Cannot remove due date from a recurring task');
# Allow removal of the due date from a non-recurring task.
qx{../src/task rc:bug.rc add nonrecurring};
$output = qx{../src/task rc:bug.rc ls};
my ($id) = $output =~ /(\d+)\s+nonrecurring/;
$output = qx{../src/task rc:bug.rc $id modify due:};
$output = qx{../src/task rc:bug.rc $id modify due: 2>&1 >/dev/null};
unlike ($output, qr/You cannot remove the due date from a recurring task./ms, 'Can remove due date from a non-recurring task');
$output = qx{../src/task rc:bug.rc diag};

View file

@ -45,12 +45,12 @@ if (open my $fh, '>', 'bug.rc')
qx{../src/task rc:bug.rc add One project:p1};
# Delete the task and note the completion status of the project.
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 delete};
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 delete 2>&1 >/dev/null};
like ($output, qr/is 0\% complete/ms, 'Empty project correctly reported as being 0% completed.');
# Add another task, complete it and note the completion status of hte project.
qx{../src/task rc:bug.rc add Two project:p1};
$output = qx{../src/task rc:bug.rc 2 done};
$output = qx{../src/task rc:bug.rc 2 done 2>&1 >/dev/null};
like ($output, qr/is 100\% complete/ms, 'Empty project correctly reported as being 100% completed.');
# Cleanup.

View file

@ -55,16 +55,16 @@ qx{../src/task rc:bug.rc add Nine pro:p1};
qx{../src/task rc:bug.rc add Ten pro:p1};
# Complete three tasks and ensure pending and done counts are updated correctly.
my $output = qx{../src/task rc:bug.rc 1-3 do};
my $output = qx{../src/task rc:bug.rc 1-3 do 2>&1 >/dev/null};
like ($output, qr/Project 'p1' is 30% complete \(7 of 10 tasks remaining\)\./ms, 'Project counts correct for a multiple done');
# Change three projects and ensure pending and done counts are updated correctly.
$output = qx{../src/task rc:bug.rc 4-6 modify pro:p2};
$output = qx{../src/task rc:bug.rc 4-6 modify pro:p2 2>&1 >/dev/null};
like ($output, qr/Project 'p1' is 42% complete \(4 of 7 tasks remaining\)\./ms, 'Project counts correct for a multiple project reassignment part a');
like ($output, qr/Project 'p2' is 0% complete \(3 of 3 tasks remaining\)\./ms, 'Project counts correct for a multiple project reassignment part b');
# Delete three tasks and ensure pending and done counts are updated correctly.
$output = qx{../src/task rc:bug.rc 7-9 del};
$output = qx{../src/task rc:bug.rc 7-9 del 2>&1 >/dev/null};
like ($output, qr/Project 'p1' is 75% complete \(1 of 4 tasks remaining\)\./ms, 'Project counts correct for a multiple delete');
# Cleanup.

View file

@ -42,7 +42,7 @@ if (open my $fh, '>', 'bug.rc')
my $output = qx{../src/task rc:bug.rc add one due:sund};
like ($output, qr/Created task 1\./, 'sund --> valid date');
$output = qx{../src/task rc:bug.rc add two due:donkey};
$output = qx{../src/task rc:bug.rc add two due:donkey 2>&1 >/dev/null};
like ($output, qr/was not recognized\./, 'donkey --> invalid date');
# Cleanup.

View file

@ -40,16 +40,16 @@ if (open my $fh, '>', 'bug.rc')
}
# Bug 899: task log does not behave correctly when logging into a project
my $output = qx{../src/task rc:bug.rc add one pro:A};
my $output = qx{../src/task rc:bug.rc add one pro:A 2>&1 >/dev/null};
like ($output, qr/ 0% complete \(1 of 1 /, '1 of 1 tasks remaining - 0%');
$output = qx{../src/task rc:bug.rc add two pro:A};
$output = qx{../src/task rc:bug.rc add two pro:A 2>&1 >/dev/null};
like ($output, qr/ 0% complete \(2 of 2 /, '2 of 2 tasks remaining - 0%');
$output = qx{../src/task rc:bug.rc 1 done};
$output = qx{../src/task rc:bug.rc 1 done 2>&1 >/dev/null};
like ($output, qr/ 50% complete \(1 of 2 /, '1 of 2 tasks remaining - 50%');
$output = qx{../src/task rc:bug.rc log three pro:A};
$output = qx{../src/task rc:bug.rc log three pro:A 2>&1 >/dev/null};
like ($output, qr/ 66% complete \(1 of 3 /, '1 of 3 tasks remaining - 66%');
# Cleanup.

View file

@ -40,14 +40,14 @@ if (open my $fh, '>', 'bug.rc')
# Attempt a blank annotation.
qx{../src/task rc:bug.rc add foo};
my $output = qx{../src/task rc:bug.rc 1 annotate};
my $output = qx{../src/task rc:bug.rc 1 annotate 2>&1 >/dev/null};
like ($output, qr/Additional text must be provided/, 'failed on blank annotation');
# Attempt an annotation without ID
$output = qx{echo "n" | ../src/task rc:bug.rc annotate bar};
$output = qx{echo "n" | ../src/task rc:bug.rc annotate bar 2>&1 >/dev/null};
like ($output, qr/Command prevented from running/, 'Filter-less write command inhibited');
$output = qx{echo "y" | ../src/task rc:bug.rc annotate bar};
$output = qx{echo "y" | ../src/task rc:bug.rc annotate bar 2>&1 >/dev/null};
unlike ($output, qr/Command prevented from running/, 'Filter-less write command permitted');
# Cleanup.

View file

@ -53,11 +53,11 @@ $output = qx{echo 'y' | ../src/task rc:delete.rc undo; ../src/task rc:delete.rc
like ($output, qr/Status\s+Pending\n/, 'Pending');
ok (-r 'completed.data', 'completed.data created');
$output = qx{../src/task rc:delete.rc 1 delete; ../src/task rc:delete.rc list};
$output = qx{../src/task rc:delete.rc 1 delete; ../src/task rc:delete.rc list 2>&1 >/dev/null};
like ($output, qr/No matches./, 'No matches');
ok (-r 'completed.data', 'completed.data created');
$output = qx{../src/task rc:delete.rc info 1};
$output = qx{../src/task rc:delete.rc info 1 2>&1 >/dev/null};
like ($output, qr/No matches\./, 'No matches'); # 10
# Add a task, delete it, and modify on the fly.

View file

@ -49,15 +49,15 @@ qx{../src/task rc:dep.rc add One};
qx{../src/task rc:dep.rc add Two};
# [2]
my $output = qx{../src/task rc:dep.rc 1 modify dep:-2};
my $output = qx{../src/task rc:dep.rc 1 modify dep:-2 2>&1 >/dev/null};
like ($output, qr/Could not delete a dependency on task 2 - not found\./, 'dependencies - remove nonexistent dependency');
# [3]
$output = qx{../src/task rc:dep.rc 1 modify dep:99};
$output = qx{../src/task rc:dep.rc 1 modify dep:99 2>&1 >/dev/null};
like ($output, qr/Could not create a dependency on task 99 - not found\./, 'dependencies - add dependency for nonexistent task');
# [4]
$output = qx{../src/task rc:dep.rc 99 modify dep:1};
$output = qx{../src/task rc:dep.rc 99 modify dep:1 2>&1 >/dev/null};
like ($output, qr/No tasks specified\./, 'dependencies - add dependency to nonexistent task');
# [5,6] t 1 dep:2; t info 1 => blocked by 2
@ -71,16 +71,16 @@ unlike ($output, qr/This task blocked by/, 'dependencies - trivial
like ($output, qr/This task is blocking\s+1 One\nUUID/, 'dependencies - trivial blocking');
# [9] t 1 dep:2 (again)
$output = qx{../src/task rc:dep.rc 1 modify dep:2};
$output = qx{../src/task rc:dep.rc 1 modify dep:2 2>&1 >/dev/null};
like ($output, qr/Task 1 already depends on task 2\./, 'dependencies - add already existing dependency');
# [10,11] t 1 dep:1 => error
$output = qx{../src/task rc:dep.rc 1 modify dep:1};
$output = qx{../src/task rc:dep.rc 1 modify dep:1 2>&1};
like ($output, qr/A task cannot be dependent on itself\./, 'dependencies - cannot depend on self');
unlike ($output, qr/Modified 1 task\./, 'dependencies - cannot depend on self');
# [12,13] t 1 dep:2; t 2 dep:1 => error
$output = qx{../src/task rc:dep.rc 2 modify dep:1};
$output = qx{../src/task rc:dep.rc 2 modify dep:1 2>&1};
like ($output, qr/Circular dependency detected and disallowed\./, 'dependencies - trivial circular');
unlike ($output, qr/Modified 1 task\./, 'dependencies - trivial circular');
@ -105,7 +105,7 @@ qx{../src/task rc:dep.rc add Five};
qx{../src/task rc:dep.rc 5 modify dep:4; ../src/task rc:dep.rc 4 modify dep:3; ../src/task rc:dep.rc 3 modify dep:2; ../src/task rc:dep.rc 2 modify dep:1};
# [17,18] 5 dep 4 dep 3 dep 2 dep 1 dep 5 => error
$output = qx{../src/task rc:dep.rc 1 modify dep:5};
$output = qx{../src/task rc:dep.rc 1 modify dep:5 2>&1 >/dev/null};
like ($output, qr/Circular dependency detected and disallowed\./, 'dependencies - nontrivial circular');
unlike ($output, qr/Modified 1 task\./, 'dependencies - nontrivial circular');

View file

@ -42,10 +42,10 @@ if (open my $fh, '>', 'bug.rc')
# Feature 559: rc.exit.on.missing.db should cause exit if rc.data.location is missing.
qx{../src/task rc:bug.rc add foo rc.debug:1};
my $output = qx{../src/task rc:bug.rc list};
unlike ($output, qr/Error.+does not exist/, 'No error on extant rc.data.location');
my $output = qx{../src/task rc:bug.rc list 2>&1 >/dev/null};
unlike ($output, qr/Error.+does not exist/, 'No error on existant rc.data.location');
$output = qx{../src/task rc:bug.rc rc.data.location=donkey list};
$output = qx{../src/task rc:bug.rc rc.data.location=donkey list 2>&1 >/dev/null};
like ($output, qr/Error.+does not exist/, 'Error on missing rc.data.location');
# Cleanup.

View file

@ -51,7 +51,7 @@ EOF
ok (-r 'import.txt', 'Created sample import data');
}
my $output = qx{../src/task rc:import.rc import import.txt};
my $output = qx{../src/task rc:import.rc import import.txt 2>&1 >/dev/null};
like ($output, qr/Imported 3 tasks\./, 'no errors');
# Imported 3 tasks successfully.
@ -79,7 +79,7 @@ unlike ($output, qr/2.+B.+one/, 't2 missing');
like ($output, qr/2\/13\/2009.+two/, 't3 present');
# Make sure that a duplicate task cannot be imported.
$output = qx{../src/task rc:import.rc import import.txt};
$output = qx{../src/task rc:import.rc import import.txt 2>&1 >/dev/null};
like ($output, qr/Cannot add task because the uuid .+ is not unique\./, 'error on duplicate uuid');
# Create import file.
@ -93,7 +93,7 @@ EOF
ok (-r 'import2.txt', 'Created second sample import data');
}
$output = qx{../src/task rc:import.rc import import2.txt};
$output = qx{../src/task rc:import.rc import import2.txt 2>&1 >/dev/null};
like ($output, qr/Imported 1 tasks\./, 'no errors');
# Imported 1 tasks successfully.

View file

@ -73,7 +73,7 @@ EOF
qx{../scripts/add-ons/import-yaml.pl <import.txt >import.json};
# Import the JSON.
my $output = qx{../src/task rc:import.rc import import.json};
my $output = qx{../src/task rc:import.rc import import.json 2>&1 >/dev/null};
like ($output, qr/Imported 3 tasks\./, '3 tasks imported');
$output = qx{../src/task rc:import.rc list};
@ -100,7 +100,7 @@ unlike ($output, qr/2.+B.+one/, 't2 missing');
like ($output, qr/9\/4\/2011.+two/, 't3 present');
# Make sure that a duplicate task cannot be imported.
$output = qx{../src/task rc:import.rc import import.json};
$output = qx{../src/task rc:import.rc import import.json 2>&1 >/dev/null};
like ($output, qr/Cannot add task because the uuid '.{36}' is not unique\./, 'error on duplicate uuid');
# Create import file.
@ -125,7 +125,7 @@ EOF
qx{../scripts/add-ons/import-yaml.pl <import.txt >import.json};
# Import the JSON.
$output = qx{../src/task rc:import.rc import import.json};
$output = qx{../src/task rc:import.rc import import.json 2>&1 >/dev/null};
like ($output, qr/Imported 1 tasks\./, '1 task imported');
# Verify.

View file

@ -47,12 +47,12 @@ my $setup = "../src/task rc:nag.rc add due:yesterday one;"
. "../src/task rc:nag.rc add six;";
qx{$setup};
like (qx{../src/task rc:nag.rc 6 do}, qr/NAG/, 'do pri: -> nag');
like (qx{../src/task rc:nag.rc 5 do}, qr/NAG/, 'do pri:L -> nag');
like (qx{../src/task rc:nag.rc 4 do}, qr/NAG/, 'do pri:M-> nag');
like (qx{../src/task rc:nag.rc 3 do}, qr/NAG/, 'do pri:H-> nag');
like (qx{../src/task rc:nag.rc 2 do}, qr/NAG/, 'do due:tomorrow -> nag');
my $output = qx{../src/task rc:nag.rc 1 do};
like (qx{../src/task rc:nag.rc 6 do 2>&1 >/dev/null}, qr/NAG/, 'do pri: -> nag');
like (qx{../src/task rc:nag.rc 5 do 2>&1 >/dev/null}, qr/NAG/, 'do pri:L -> nag');
like (qx{../src/task rc:nag.rc 4 do 2>&1 >/dev/null}, qr/NAG/, 'do pri:M-> nag');
like (qx{../src/task rc:nag.rc 3 do 2>&1 >/dev/null}, qr/NAG/, 'do pri:H-> nag');
like (qx{../src/task rc:nag.rc 2 do 2>&1 >/dev/null}, qr/NAG/, 'do due:tomorrow -> nag');
my $output = qx{../src/task rc:nag.rc 1 do 2>&1 >/dev/null};
unlike ($output, qr/NAG/, 'do due:yesterday -> no nag');
# Cleanup.

View file

@ -40,30 +40,30 @@ if (open my $fh, '>', 'pro.rc')
}
# Test the project status numbers.
my $output = qx{../src/task rc:pro.rc add one pro:foo};
my $output = qx{../src/task rc:pro.rc add one pro:foo 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 0% complete \(1 of 1 tasks remaining\)\./, 'add one');
$output = qx{../src/task rc:pro.rc add two pro:'foo'};
$output = qx{../src/task rc:pro.rc add two pro:'foo' 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 0% complete \(2 of 2 tasks remaining\)\./, 'add two');
$output = qx{../src/task rc:pro.rc add three pro:'foo'};
$output = qx{../src/task rc:pro.rc add three pro:'foo' 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 0% complete \(3 of 3 tasks remaining\)\./, 'add three');
$output = qx{../src/task rc:pro.rc add four pro:'foo'};
$output = qx{../src/task rc:pro.rc add four pro:'foo' 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 0% complete \(4 of 4 tasks remaining\)\./, 'add four');
$output = qx{../src/task rc:pro.rc 1 done};
$output = qx{../src/task rc:pro.rc 1 done 2>&1 >/dev/null};
like ($output, qr/Project 'foo' is 25% complete \(3 of 4 tasks remaining\)\./, 'done one');
$output = qx{../src/task rc:pro.rc 2 delete};
$output = qx{../src/task rc:pro.rc 2 delete 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 33% complete \(2 of 3 tasks remaining\)\./, 'delete two');
$output = qx{../src/task rc:pro.rc 3 modify pro:bar};
$output = qx{../src/task rc:pro.rc 3 modify pro:bar 2>&1 >/dev/null};
like ($output, qr/The project 'foo' has changed\. Project 'foo' is 50% complete \(1 of 2 tasks remaining\)\./, 'change project');
like ($output, qr/The project 'bar' has changed\. Project 'bar' is 0% complete \(1 of 1 tasks remaining\)\./, 'change project');
# Test projects with spaces in them.
$output = qx{../src/task rc:pro.rc 3 modify pro:\\"foo bar\\"};
$output = qx{../src/task rc:pro.rc 3 modify pro:\\"foo bar\\" 2>&1 >/dev/null};
like ($output, qr/The project 'foo bar' has changed\./, 'project with spaces');
# Cleanup.

View file

@ -52,7 +52,7 @@ qx{../src/task rc:recur.rc 2 do};
qx{../src/task rc:recur.rc 3 do};
qx{../src/task rc:recur.rc 4 do};
qx{../src/task rc:recur.rc 5 do};
$output = qx{../src/task rc:recur.rc list};
$output = qx{../src/task rc:recur.rc list 2>&1 >/dev/null};
like ($output, qr/and was deleted/, 'Parent task deleted');
$output = qx{../src/task rc:recur.rc diag};

View file

@ -42,16 +42,16 @@ if (open my $fh, '>', 'shadow.rc')
ok (-r 'shadow.rc', 'Created shadow.rc');
}
my $output = qx{../src/task rc:shadow.rc add one};
my $output = qx{../src/task rc:shadow.rc add one 2>&1 >/dev/null};
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file updated on add');
$output = qx{../src/task rc:shadow.rc list};
$output = qx{../src/task rc:shadow.rc list 2>&1 >/dev/null};
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file not updated on list');
$output = qx{../src/task rc:shadow.rc 1 delete};
$output = qx{../src/task rc:shadow.rc 1 delete 2>&1 >/dev/null};
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file updated on delete');
$output = qx{../src/task rc:shadow.rc list};
$output = qx{../src/task rc:shadow.rc list 2>&1 >/dev/null};
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file not updated on list');
# Inspect the shadow file.

View file

@ -59,7 +59,7 @@ like ($output, qr/\bab\s*$/m, 'abc,ab,a,b | a -> ab');
$output = qx{../src/task rc:sp.rc list project:abc};
like ($output, qr/\babc\s*$/m, 'abc,ab,a,b | a -> abc');
$output = qx{../src/task rc:sp.rc list project:abcd};
$output = qx{../src/task rc:sp.rc list project:abcd 2>&1 >/dev/null};
like ($output, qr/No matches./, 'abc,ab,a,b | abcd -> nul');
# Cleanup.

View file

@ -53,7 +53,7 @@ $output = qx{../src/task rc:undo.rc undo; ../src/task rc:undo.rc info 1};
ok (-r 'completed.data', 'completed.data created');
like ($output, qr/Status\s+Pending\n/, 'Pending');
$output = qx{../src/task rc:undo.rc 1 do; ../src/task rc:undo.rc list};
$output = qx{../src/task rc:undo.rc 1 do; ../src/task rc:undo.rc list 2>&1 >/dev/null};
like ($output, qr/No matches/, 'No matches');
# Cleanup.

View file

@ -74,7 +74,7 @@ unlike ($output, qr/tomorrow/ms, 'waiting task invisible');
$output = qx{../src/task rc:wait.rc all status:waiting wait:tomorrow};
like ($output, qr/tomorrow/ms, 'waiting task visible when specifically queried');
$output = qx{../src/task rc:wait.rc add Complain due:today wait:tomorrow};
$output = qx{../src/task rc:wait.rc add Complain due:today wait:tomorrow 2>&1 >/dev/null};
like ($output, qr/Warning: You have specified that the 'wait' date is after the 'due' date\./, 'warning on wait after due');
# Cleanup.