mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47:19 +02:00
Unit Tests
- Added proper handling for when no command or filter is specified, and no rc.default.command exists. - Improved wording on above error message. - Fixed typo in previous commit (managed to check in code before the build completed, and ultimately failed). - Now reports errors that occur during initialization at the same level of verbosity as during command execution.
This commit is contained in:
parent
8aeef40b80
commit
7fbe124fe0
6 changed files with 26 additions and 12 deletions
|
@ -683,7 +683,7 @@ void Arguments::inject_defaults ()
|
|||
if (defaultCommand != "")
|
||||
{
|
||||
capture_first (defaultCommand);
|
||||
context.header ("[task " + trim (defaultCommand) + "]");
|
||||
context.header ("[" + combine () + "]");
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_TRIVIAL_INPUT);
|
||||
|
|
|
@ -174,6 +174,27 @@ int Context::initialize (int argc, const char** argv)
|
|||
std::cout << *d << "\n";
|
||||
}
|
||||
|
||||
// Dump all headers, controlled by 'header' verbosity token.
|
||||
if (rc && verbose ("header"))
|
||||
{
|
||||
std::vector <std::string>::iterator h;
|
||||
for (h = headers.begin (); h != headers.end (); ++h)
|
||||
if (color ())
|
||||
std::cout << colorizeHeader (*h) << "\n";
|
||||
else
|
||||
std::cout << *h << "\n";
|
||||
}
|
||||
|
||||
// Dump all footnotes, controlled by 'footnote' verbosity token.
|
||||
if (rc && verbose ("footnote"))
|
||||
{
|
||||
std::vector <std::string>::iterator f;
|
||||
for (f = footnotes.begin (); f != footnotes.end (); ++f)
|
||||
if (color ())
|
||||
std::cout << colorizeFootnote (*f) << "\n";
|
||||
else
|
||||
std::cout << *f << "\n";
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -955,7 +955,7 @@ void Task::validate () const
|
|||
|
||||
if (has ("priority"))
|
||||
{
|
||||
std::string priority - get ("priority");
|
||||
std::string priority = get ("priority");
|
||||
if (priority != "H" &&
|
||||
priority != "M" &&
|
||||
priority != "L")
|
||||
|
|
|
@ -339,8 +339,8 @@
|
|||
#define STRING_UNKNOWN_ERROR "Unknown error."
|
||||
#define STRING_NO_HOME "Could not read home directory from the passwd file."
|
||||
#define STRING_TAGS_NO_COMMAS "Tags are not permitted to contain commas."
|
||||
#define STRING_TRIVIAL_INPUT "You must specify a command, or a task ID to modify."
|
||||
#define STRING_ASSUME_INFO "No command specified - assuming 'information'"
|
||||
#define STRING_TRIVIAL_INPUT "You must specify a command or a task to modify."
|
||||
#define STRING_ASSUME_INFO "No command specified - assuming 'information'."
|
||||
#define STRING_INFINITE_LOOP "Terminated substitution because more than {1} changes were made - infinite loop protection."
|
||||
|
||||
// Feedback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue