mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-02 14:38:34 +02:00
Enhancements - T2 & Subst
- Implemented more helper functions in T2, prior to integration. - Completed Subst. - Completed Subst unit tests. - Eliminated T::getAnnotationCount.
This commit is contained in:
parent
ccff27b535
commit
7248267a72
10 changed files with 149 additions and 71 deletions
1
src/tests/.gitignore
vendored
1
src/tests/.gitignore
vendored
|
@ -12,3 +12,4 @@ mod.t
|
|||
record.t
|
||||
stringtable.t
|
||||
nibbler.t
|
||||
subst.t
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
PROJECT = t.t tdb.t date.t duration.t t.benchmark.t text.t autocomplete.t \
|
||||
parse.t seq.t att.t mod.t stringtable.t record.t nibbler.t # subst.t
|
||||
parse.t seq.t att.t mod.t stringtable.t record.t nibbler.t subst.t
|
||||
CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti
|
||||
LFLAGS = -L/usr/local/lib
|
||||
OBJECTS = ../TDB.o ../T.o ../parse.o ../text.o ../Date.o ../Duration.o \
|
||||
../util.o ../Config.o ../Sequence.o ../Att.o ../Record.o ../Mod.o \
|
||||
../StringTable.o ../Subst.o ../Nibbler.o
|
||||
OBJECTS = ../TDB.o ../TDB2.o ../T.o ../T2.o ../parse.o ../text.o ../Date.o \
|
||||
../Duration.o ../util.o ../Config.o ../Sequence.o ../Att.o \
|
||||
../Record.o ../Mod.o ../StringTable.o ../Subst.o ../Nibbler.o \
|
||||
../Filter.o ../Location.o
|
||||
|
||||
all: $(PROJECT)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <T.h>
|
||||
#include <T2.h>
|
||||
#include <Subst.h>
|
||||
#include <test.h>
|
||||
|
||||
|
@ -33,14 +33,18 @@ int main (int argc, char** argv)
|
|||
{
|
||||
UnitTest t (2);
|
||||
|
||||
T task;
|
||||
T2 task;
|
||||
task.set ("description", "one two three four");
|
||||
|
||||
Subst s;
|
||||
if (s.parse ("/two/TWO/"))
|
||||
{
|
||||
s.apply (task);
|
||||
t.is (task.get ("description"), "one TWO three four", "single word subst");
|
||||
std::string description = task.get ("description");
|
||||
std::vector <Att> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
|
||||
s.apply (description, annotations);
|
||||
t.is (description, "one TWO three four", "single word subst");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -49,8 +53,12 @@ int main (int argc, char** argv)
|
|||
|
||||
if (s.parse ("/e /E /g"))
|
||||
{
|
||||
s.apply (task);
|
||||
t.is (task.get ("description"), "onE TWO threE four", "multiple word subst");
|
||||
std::string description = task.get ("description");
|
||||
std::vector <Att> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
|
||||
s.apply (description, annotations);
|
||||
t.is (description, "onE two threE four", "multiple word subst");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest test (10);
|
||||
UnitTest test (9);
|
||||
|
||||
T t;
|
||||
std::string s = t.compose ();
|
||||
|
@ -88,7 +88,6 @@ int main (int argc, char** argv)
|
|||
std::string format = t.compose ();
|
||||
test.is (format.substr (36, 20), " - [foo] [bar:baz] [", "compose tag, attribute");
|
||||
test.is (format.substr (66, 16), ":\"woof\"] sample\n", "compose annotation");
|
||||
test.is (t.getAnnotationCount (), 1, "annotation count");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue