mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Constify some catches.
This commit is contained in:
parent
589d8fab5c
commit
7a6cdde571
14 changed files with 19 additions and 19 deletions
|
@ -319,7 +319,7 @@ void TF2::load_tasks ()
|
||||||
_loaded_tasks = true;
|
_loaded_tasks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (const std::string& e)
|
||||||
{
|
{
|
||||||
throw e + format (STRING_TDB2_PARSE_ERROR, _file._data, line_number);
|
throw e + format (STRING_TDB2_PARSE_ERROR, _file._data, line_number);
|
||||||
}
|
}
|
||||||
|
|
|
@ -811,7 +811,7 @@ ARE_THESE_REALLY_HARMFUL:
|
||||||
parseTask (task, after, dateformat);
|
parseTask (task, after, dateformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (const std::string& e)
|
||||||
{
|
{
|
||||||
problem = e;
|
problem = e;
|
||||||
oops = true;
|
oops = true;
|
||||||
|
|
|
@ -97,7 +97,7 @@ int CmdMerge::execute (std::string& output)
|
||||||
{
|
{
|
||||||
context.tdb2.merge (file);
|
context.tdb2.merge (file);
|
||||||
}
|
}
|
||||||
catch (std::string& e) {
|
catch (const std::string& e) {
|
||||||
if (e == STRING_TDB2_UP_TO_DATE)
|
if (e == STRING_TDB2_UP_TO_DATE)
|
||||||
{
|
{
|
||||||
output += e + "\n";
|
output += e + "\n";
|
||||||
|
|
|
@ -111,7 +111,7 @@ int CmdShell::execute (std::string&)
|
||||||
context.run ();
|
context.run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (const std::string& error)
|
||||||
{
|
{
|
||||||
std::cerr << error << "\n";
|
std::cerr << error << "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ int main (int argc, const char** argv)
|
||||||
status = context.run ();
|
status = context.run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (const std::string& error)
|
||||||
{
|
{
|
||||||
std::cerr << error << "\n";
|
std::cerr << error << "\n";
|
||||||
status = -1;
|
status = -1;
|
||||||
|
|
|
@ -402,7 +402,7 @@ int main (int argc, char** argv)
|
||||||
t.is (r26.toString ("YMDHNS"), "20100314235959", "increment across spring DST boundary");
|
t.is (r26.toString ("YMDHNS"), "20100314235959", "increment across spring DST boundary");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (const std::string& e)
|
||||||
{
|
{
|
||||||
t.fail ("Exception thrown.");
|
t.fail ("Exception thrown.");
|
||||||
t.diag (e);
|
t.diag (e);
|
||||||
|
|
|
@ -69,7 +69,7 @@ int main (int argc, char** argv)
|
||||||
// TODO dom.set rc.name
|
// TODO dom.set rc.name
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (const std::string& error)
|
||||||
{
|
{
|
||||||
t.diag (error);
|
t.diag (error);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -58,7 +58,7 @@ int main (int argc, char** argv)
|
||||||
t.is (format ("pre {3}{1}{2} post", "one", "two", "three"), "pre threeonetwo post", "format 3b");
|
t.is (format ("pre {3}{1}{2} post", "one", "two", "three"), "pre threeonetwo post", "format 3b");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (const std::string& error)
|
||||||
{
|
{
|
||||||
t.diag (error);
|
t.diag (error);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -175,7 +175,7 @@ int main (int argc, char** argv)
|
||||||
t.is (json::decode (encoded), "one\\", "json::decode one\\\\\\\\ -> one\\\\");
|
t.is (json::decode (encoded), "one\\", "json::decode one\\\\\\\\ -> one\\\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e) {t.diag (e);}
|
catch (const std::string& e) {t.diag (e);}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,7 +747,7 @@ int main (int argc, char** argv)
|
||||||
t.is (n.next (1), "b", " 'bcde' : skip () -> 'b'");
|
t.is (n.next (1), "b", " 'bcde' : skip () -> 'b'");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e) {t.diag (e);}
|
catch (const std::string& e) {t.diag (e);}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,33 +42,33 @@ int main (int argc, char** argv)
|
||||||
Task task;
|
Task task;
|
||||||
|
|
||||||
try {task = Task ("");}
|
try {task = Task ("");}
|
||||||
catch (std::string& e){t.diag (e); good = false;}
|
catch (const std::string& e){t.diag (e); good = false;}
|
||||||
t.notok (good, "Task::Task ('')");
|
t.notok (good, "Task::Task ('')");
|
||||||
|
|
||||||
// []
|
// []
|
||||||
good = true;
|
good = true;
|
||||||
try {task = Task ("[]");}
|
try {task = Task ("[]");}
|
||||||
catch (std::string& e){t.diag (e); good = false;}
|
catch (const std::string& e){t.diag (e); good = false;}
|
||||||
t.notok (good, "Task::Task ('[]')");
|
t.notok (good, "Task::Task ('[]')");
|
||||||
|
|
||||||
// [name:"value"]
|
// [name:"value"]
|
||||||
good = true;
|
good = true;
|
||||||
try {task = Task ("[name:\"value\"]");}
|
try {task = Task ("[name:\"value\"]");}
|
||||||
catch (std::string& e){t.diag (e); good = false;}
|
catch (const std::string& e){t.diag (e); good = false;}
|
||||||
t.ok (good, "Task::Task ('[name:\"value\"]')");
|
t.ok (good, "Task::Task ('[name:\"value\"]')");
|
||||||
t.is (task.get ("name"), "value", "name=value");
|
t.is (task.get ("name"), "value", "name=value");
|
||||||
|
|
||||||
// [name:"one two"]
|
// [name:"one two"]
|
||||||
good = true;
|
good = true;
|
||||||
try {task = Task ("[name:\"one two\"]");}
|
try {task = Task ("[name:\"one two\"]");}
|
||||||
catch (std::string& e){t.diag (e); good = false;}
|
catch (const std::string& e){t.diag (e); good = false;}
|
||||||
t.ok (good, "Task::Task ('[name:\"one two\"]')");
|
t.ok (good, "Task::Task ('[name:\"one two\"]')");
|
||||||
t.is (task.get ("name"), "one two", "name=one two");
|
t.is (task.get ("name"), "one two", "name=one two");
|
||||||
|
|
||||||
// [one:two three:four]
|
// [one:two three:four]
|
||||||
good = true;
|
good = true;
|
||||||
try {task = Task ("[one:\"two\" three:\"four\"]");}
|
try {task = Task ("[one:\"two\" three:\"four\"]");}
|
||||||
catch (std::string& e){t.diag (e); good = false;}
|
catch (const std::string& e){t.diag (e); good = false;}
|
||||||
t.ok (good, "Task::Task ('[one:\"two\" three:\"four\"]')");
|
t.ok (good, "Task::Task ('[one:\"two\" three:\"four\"]')");
|
||||||
t.is (task.get ("one"), "two", "one=two");
|
t.is (task.get ("one"), "two", "one=two");
|
||||||
t.is (task.get ("three"), "four", "three=four");
|
t.is (task.get ("three"), "four", "three=four");
|
||||||
|
|
|
@ -75,7 +75,7 @@ int main (int argc, char** argv)
|
||||||
good = true;
|
good = true;
|
||||||
try {
|
try {
|
||||||
empty.getUuid();
|
empty.getUuid();
|
||||||
} catch (std::string& e) { t.diag(e); good = false; }
|
} catch (const std::string& e) { t.diag(e); good = false; }
|
||||||
t.notok (good, "Taskmod::getUuid() not");
|
t.notok (good, "Taskmod::getUuid() not");
|
||||||
|
|
||||||
// issetAfter() not
|
// issetAfter() not
|
||||||
|
@ -87,7 +87,7 @@ int main (int argc, char** argv)
|
||||||
try {
|
try {
|
||||||
std::string uuid = newMod.getUuid();
|
std::string uuid = newMod.getUuid();
|
||||||
t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()");
|
t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()");
|
||||||
} catch (std::string& e) {
|
} catch (const std::string& e) {
|
||||||
t.diag(e);
|
t.diag(e);
|
||||||
t.fail("Taskmod::getUuid()");
|
t.fail("Taskmod::getUuid()");
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ int main (int argc, char** argv)
|
||||||
// TODO gc
|
// TODO gc
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (const std::string& error)
|
||||||
{
|
{
|
||||||
t.diag (error);
|
t.diag (error);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -175,7 +175,7 @@ int main (int argc, char** argv)
|
||||||
t.ok (string_view.lines () > 4, "View::lines > 4");
|
t.ok (string_view.lines () > 4, "View::lines > 4");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (const std::string& e)
|
||||||
{
|
{
|
||||||
t.fail ("Exception thrown.");
|
t.fail ("Exception thrown.");
|
||||||
t.diag (e);
|
t.diag (e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue