make TDB2.undo non-public
The stats command calls an API to provide this information in a way that will still be relevant for TaskChampion, while CmdInfo's access to the data remains. The TaskChampion interface for per-task hitsory is still not ready.
This commit is contained in:
committed by
Tomas Babej
parent
2f30bc8cbf
commit
4ebd0ffb39
@@ -60,40 +60,40 @@ int main (int, char**)
|
||||
// Try reading an empty database.
|
||||
std::vector <Task> pending = context.tdb2.pending.get_tasks ();
|
||||
std::vector <Task> completed = context.tdb2.completed.get_tasks ();
|
||||
std::vector <std::string> undo = context.tdb2.undo.get_lines ();
|
||||
int num_reverts_possible = context.tdb2.num_reverts_possible ();
|
||||
int num_local_changes = context.tdb2.num_local_changes ();
|
||||
|
||||
t.is ((int) pending.size (), 0, "TDB2 Read empty pending");
|
||||
t.is ((int) completed.size (), 0, "TDB2 Read empty completed");
|
||||
t.is ((int) undo.size (), 0, "TDB2 Read empty undo");
|
||||
t.is ((int) num_local_changes, 0, "TDB2 Read empty backlog");
|
||||
t.is ((int) pending.size (), 0, "TDB2 Read empty pending");
|
||||
t.is ((int) completed.size (), 0, "TDB2 Read empty completed");
|
||||
t.is ((int) num_reverts_possible, 0, "TDB2 Read empty undo");
|
||||
t.is ((int) num_local_changes, 0, "TDB2 Read empty backlog");
|
||||
|
||||
// Add a task.
|
||||
Task task (R"([description:"description" name:"value"])");
|
||||
context.tdb2.add (task);
|
||||
|
||||
pending = context.tdb2.pending.get_tasks ();
|
||||
completed = context.tdb2.completed.get_tasks ();
|
||||
undo = context.tdb2.undo.get_lines ();
|
||||
num_local_changes = context.tdb2.num_local_changes ();
|
||||
pending = context.tdb2.pending.get_tasks ();
|
||||
completed = context.tdb2.completed.get_tasks ();
|
||||
num_reverts_possible = context.tdb2.num_reverts_possible ();
|
||||
num_local_changes = context.tdb2.num_local_changes ();
|
||||
|
||||
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
|
||||
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
|
||||
t.is ((int) undo.size (), 3, "TDB2 after add, 3 undo lines");
|
||||
t.is ((int) num_local_changes, 1, "TDB2 after add, 1 backlog task");
|
||||
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
|
||||
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
|
||||
t.is ((int) num_reverts_possible, 3, "TDB2 after add, 3 undo lines");
|
||||
t.is ((int) num_local_changes, 1, "TDB2 after add, 1 backlog task");
|
||||
|
||||
task.set ("description", "This is a test");
|
||||
context.tdb2.modify (task);
|
||||
|
||||
pending = context.tdb2.pending.get_tasks ();
|
||||
completed = context.tdb2.completed.get_tasks ();
|
||||
undo = context.tdb2.undo.get_lines ();
|
||||
num_local_changes = context.tdb2.num_local_changes ();
|
||||
pending = context.tdb2.pending.get_tasks ();
|
||||
completed = context.tdb2.completed.get_tasks ();
|
||||
num_reverts_possible = context.tdb2.num_reverts_possible ();
|
||||
num_local_changes = context.tdb2.num_local_changes ();
|
||||
|
||||
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
|
||||
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
|
||||
t.is ((int) undo.size (), 7, "TDB2 after add, 7 undo lines");
|
||||
t.is ((int) num_local_changes, 2, "TDB2 after add, 2 backlog task");
|
||||
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
|
||||
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
|
||||
t.is ((int) num_reverts_possible, 7, "TDB2 after add, 7 undo lines");
|
||||
t.is ((int) num_local_changes, 2, "TDB2 after add, 2 backlog task");
|
||||
|
||||
context.tdb2.commit ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user