Enhancement - related to, but not fixing bug #293
- Added new attribute modifiers 'word' and 'noword' which find the existence of whole words, or prove the non-existence of whole words. If a task has the description "Pay the bill", then "description.word:the" will match, but "description.word:th" will not. For partial word matches, there is still "description.contains:th". - Added unit tests for the text.cpp functions. - Added unit tests including the new modifiers in filters. - Added unit tests to parse the new modifiers. - Modified man page. - Modified the Context::autoFilter processing to use the new modifiers for +tag and -tag filtering. - Added a support email to an error message, while looking at the filter code. - Added new modifiers to the help report. - Modified a utf8.t unit test to include an alphanumeric tag, rather than a smiley face.
This commit is contained in:
@@ -34,7 +34,7 @@ Context context;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest test (14);
|
||||
UnitTest test (20);
|
||||
|
||||
// Create a filter consisting of two Att criteria.
|
||||
Filter f;
|
||||
@@ -66,6 +66,7 @@ int main (int argc, char** argv)
|
||||
// Modifiers.
|
||||
Task mods;
|
||||
mods.set ("name", "value");
|
||||
mods.set ("description", "hello, world.");
|
||||
|
||||
Att a ("name", "is", "value");
|
||||
f.clear ();
|
||||
@@ -124,6 +125,42 @@ int main (int argc, char** argv)
|
||||
"below"
|
||||
*/
|
||||
|
||||
a = Att ("description", "word", "hello");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.word:hello = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "word", "world");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.word:world = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "word", "pig");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.word:pig = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "hello");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.noword:hello = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "world");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.noword:world = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "pig");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.noword:pig = match");
|
||||
// TODO test inverse.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user