Enhancement - confirmation on big changes

- Implemented confirmation on big changes.  That means if the description is
  changed, or more than 2 tasks are modified in a single command.
- Implemented taskDiff to detect differences between two tasks.
- Implemented taskDifferences to describe differences between two tasks.
This commit is contained in:
Paul Beckingham
2009-06-27 17:09:29 -04:00
parent 8e8f5935b3
commit 6e4f60c4fe
4 changed files with 70 additions and 23 deletions

View File

@@ -34,7 +34,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (17);
UnitTest t (19);
// TODO bool confirm (const std::string&);
// TODO int confirm3 (const std::string&);
@@ -80,14 +80,16 @@ int main (int argc, char** argv)
Task rightAgain (right);
std::string output = taskDiff (left, right);
t.ok (output.find ("zero was changed from '0' to '00'.\n") != std::string::npos, "Detected change zero:0 -> zero:00");
t.ok (output.find ("one was deleted.\n") != std::string::npos, "Detected deletion one:1 ->");
t.ok (output.find ("two") == std::string::npos, "Detected no change two:2 -> two:2");
t.ok (output.find ("three was set to '3'.\n") != std::string::npos, "Detected addition -> three:3");
std::string output = taskDifferences (left, right);
t.ok (taskDiff (left, right), "Detected changes");
t.ok (output.find ("zero was changed from '0' to '00'.") != std::string::npos, "Detected change zero:0 -> zero:00");
t.ok (output.find ("one was deleted.") != std::string::npos, "Detected deletion one:1 ->");
t.ok (output.find ("two") == std::string::npos, "Detected no change two:2 -> two:2");
t.ok (output.find ("three was set to '3'.") != std::string::npos, "Detected addition -> three:3");
output = taskDiff (right, rightAgain);
t.ok (output.find ("No changes were made.\n") != std::string::npos, "No changes detected");
t.notok (taskDiff (right, rightAgain), "No changes detected");
output = taskDifferences (right, rightAgain);
t.ok (output.find ("No changes were made.") != std::string::npos, "No changes detected");
return 0;
}