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 t (117);
|
||||
UnitTest t (147);
|
||||
|
||||
// void wrapText (std::vector <std::string>& lines, const std::string& text, const int width)
|
||||
std::string text = "This is a test of the line wrapping code.";
|
||||
@@ -267,6 +267,44 @@ int main (int argc, char** argv)
|
||||
t.notok (noVerticalSpace ("a\rb"), "noVerticalSpace 'a\\rb' -> false");
|
||||
t.notok (noVerticalSpace ("a\fb"), "noVerticalSpace 'a\\fb' -> false");
|
||||
|
||||
text = "Hello, world.";
|
||||
// 0123456789012
|
||||
// s e s e
|
||||
|
||||
// bool isWordStart (const std::string&, std::string::size_type);
|
||||
t.notok (isWordStart ("", 0), "isWordStart (\"\", 0) -> false");
|
||||
t.ok (isWordStart ("foo", 0), "isWordStart (\"foo\", 0) -> true");
|
||||
t.ok (isWordStart (text, 0), "isWordStart (\"Hello, world.\", 0) -> true");
|
||||
t.notok (isWordStart (text, 1), "isWordStart (\"Hello, world.\", 1) -> false");
|
||||
t.notok (isWordStart (text, 2), "isWordStart (\"Hello, world.\", 2) -> false");
|
||||
t.notok (isWordStart (text, 3), "isWordStart (\"Hello, world.\", 3) -> false");
|
||||
t.notok (isWordStart (text, 4), "isWordStart (\"Hello, world.\", 4) -> false");
|
||||
t.notok (isWordStart (text, 5), "isWordStart (\"Hello, world.\", 5) -> false");
|
||||
t.notok (isWordStart (text, 6), "isWordStart (\"Hello, world.\", 6) -> false");
|
||||
t.ok (isWordStart (text, 7), "isWordStart (\"Hello, world.\", 7) -> true");
|
||||
t.notok (isWordStart (text, 8), "isWordStart (\"Hello, world.\", 8) -> false");
|
||||
t.notok (isWordStart (text, 9), "isWordStart (\"Hello, world.\", 9) -> false");
|
||||
t.notok (isWordStart (text, 10), "isWordStart (\"Hello, world.\", 10) -> false");
|
||||
t.notok (isWordStart (text, 11), "isWordStart (\"Hello, world.\", 11) -> false");
|
||||
t.notok (isWordStart (text, 12), "isWordStart (\"Hello, world.\", 12) -> false");
|
||||
|
||||
// bool isWordEnd (const std::string&, std::string::size_type);
|
||||
t.notok (isWordEnd ("", 0), "isWordEnd (\"\", 0) -> false");
|
||||
t.ok (isWordEnd ("foo", 2), "isWordEnd (\"foo\", 2) -> true");
|
||||
t.notok (isWordEnd (text, 0), "isWordEnd (\"Hello, world.\", 0) -> false");
|
||||
t.notok (isWordEnd (text, 1), "isWordEnd (\"Hello, world.\", 1) -> false");
|
||||
t.notok (isWordEnd (text, 2), "isWordEnd (\"Hello, world.\", 2) -> false");
|
||||
t.notok (isWordEnd (text, 3), "isWordEnd (\"Hello, world.\", 3) -> false");
|
||||
t.ok (isWordEnd (text, 4), "isWordEnd (\"Hello, world.\", 4) -> true");
|
||||
t.notok (isWordEnd (text, 5), "isWordEnd (\"Hello, world.\", 5) -> false");
|
||||
t.notok (isWordEnd (text, 6), "isWordEnd (\"Hello, world.\", 6) -> false");
|
||||
t.notok (isWordEnd (text, 7), "isWordEnd (\"Hello, world.\", 7) -> false");
|
||||
t.notok (isWordEnd (text, 8), "isWordEnd (\"Hello, world.\", 8) -> false");
|
||||
t.notok (isWordEnd (text, 9), "isWordEnd (\"Hello, world.\", 9) -> false");
|
||||
t.notok (isWordEnd (text, 10), "isWordEnd (\"Hello, world.\", 10) -> false");
|
||||
t.ok (isWordEnd (text, 11), "isWordEnd (\"Hello, world.\", 11) -> true");
|
||||
t.notok (isWordEnd (text, 12), "isWordEnd (\"Hello, world.\", 12) -> false");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user