mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +02:00
Code Cleanup
- Removed unused uti.cpp indentTree function.
This commit is contained in:
parent
adee92a6b9
commit
e15907f3f1
3 changed files with 1 additions and 37 deletions
14
src/util.cpp
14
src/util.cpp
|
@ -347,20 +347,6 @@ int execute (
|
||||||
// - delimiter is the character used to split up projects into subprojects.
|
// - delimiter is the character used to split up projects into subprojects.
|
||||||
// - defaults to the period, '.'
|
// - defaults to the period, '.'
|
||||||
//
|
//
|
||||||
const std::vector<std::string> indentTree (
|
|
||||||
const std::vector<std::string>& values,
|
|
||||||
const std::string& whitespace /* = " " */,
|
|
||||||
char delimiter/* = '.' */)
|
|
||||||
{
|
|
||||||
std::vector <std::string> modified;
|
|
||||||
std::vector <std::string>::const_iterator i;
|
|
||||||
for (i = values.begin (); i != values.end (); ++i)
|
|
||||||
modified.push_back (indentProject (*i, whitespace, delimiter));
|
|
||||||
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
const std::string indentProject (
|
const std::string indentProject (
|
||||||
const std::string& project,
|
const std::string& project,
|
||||||
const std::string& whitespace /* = " " */,
|
const std::string& whitespace /* = " " */,
|
||||||
|
|
|
@ -61,11 +61,6 @@ int execute (const std::string&, const std::vector <std::string>&, const std::st
|
||||||
int flock (int, int);
|
int flock (int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::vector<std::string> indentTree (
|
|
||||||
const std::vector<std::string>&,
|
|
||||||
const std::string& whitespace = " ",
|
|
||||||
char delimiter = '.');
|
|
||||||
|
|
||||||
const std::string indentProject (
|
const std::string indentProject (
|
||||||
const std::string&,
|
const std::string&,
|
||||||
const std::string& whitespace = " ",
|
const std::string& whitespace = " ",
|
||||||
|
|
|
@ -36,7 +36,7 @@ Context context;
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
UnitTest t (29);
|
UnitTest t (23);
|
||||||
|
|
||||||
// Ensure environment has no influence.
|
// Ensure environment has no influence.
|
||||||
unsetenv ("TASKDATA");
|
unsetenv ("TASKDATA");
|
||||||
|
@ -89,23 +89,6 @@ int main (int argc, char** argv)
|
||||||
output = taskDifferences (right, rightAgain);
|
output = taskDifferences (right, rightAgain);
|
||||||
t.ok (output.find ("No changes will be made") != std::string::npos, "No changes detected");
|
t.ok (output.find ("No changes will be made") != std::string::npos, "No changes detected");
|
||||||
|
|
||||||
// see also indirect tests of indentProject and extractParents in `project.t'.
|
|
||||||
// std::vector<std::string> indentTree (const std::vector<std::string>&, const std::string whitespace=" ", char delimiter='.');
|
|
||||||
std::vector <std::string> flat;
|
|
||||||
flat.push_back ("one");
|
|
||||||
flat.push_back ("one.two");
|
|
||||||
flat.push_back ("one.two.three");
|
|
||||||
flat.push_back ("one.four");
|
|
||||||
flat.push_back ("two");
|
|
||||||
|
|
||||||
std::vector <std::string> structured = indentTree (flat, " ", '.');
|
|
||||||
t.is (structured.size (), (size_t) 5, "indentTree yields 5 strings");
|
|
||||||
t.is (structured[0], "one", "indentTree 'one' -> 'one'");
|
|
||||||
t.is (structured[1], " two", "indentTree 'one.two' -> ' two'");
|
|
||||||
t.is (structured[2], " three", "indentTree 'one.two.three' -> ' three'");
|
|
||||||
t.is (structured[3], " four", "indentTree 'one.four' -> ' four'");
|
|
||||||
t.is (structured[4], "two", "indentTree 'two' -> 'two'");
|
|
||||||
|
|
||||||
// std::vector<std::string> indentProject (const std::string&, const std::string whitespace=" ", char delimiter='.');
|
// std::vector<std::string> indentProject (const std::string&, const std::string whitespace=" ", char delimiter='.');
|
||||||
t.is (indentProject (""), "", "indentProject '' -> ''");
|
t.is (indentProject (""), "", "indentProject '' -> ''");
|
||||||
t.is (indentProject ("one"), "one", "indentProject 'one' -> 'one'");
|
t.is (indentProject ("one"), "one", "indentProject 'one' -> 'one'");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue