mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 05:27:47 +02:00
Unit Tests
- Added more Lexer::split tests.
This commit is contained in:
parent
26d9be8164
commit
8a5d7bb569
1 changed files with 10 additions and 1 deletions
|
@ -36,7 +36,7 @@ Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (176);
|
||||
UnitTest t (181);
|
||||
|
||||
std::vector <std::pair <std::string, Lexer::Type> > tokens;
|
||||
std::string token;
|
||||
|
@ -310,6 +310,15 @@ int main (int argc, char** argv)
|
|||
t.is (items[3], "B", "split ' ( A or B ) ' -> [3] 'B'");
|
||||
t.is (items[4], ")", "split ' ( A or B ) ' -> [4] ')'");
|
||||
|
||||
// Test simple mode with contrived tokens that ordinarily split.
|
||||
unsplit = " +-* a+b 12.3e4 'c d'";
|
||||
Lexer::split (items, unsplit);
|
||||
t.is (items.size (), (size_t) 4, "split ' +-* a+b 12.3e4 'c d''");
|
||||
t.is (items[0], "+-*", "split ' +-* a+b 12.3e4 'c d'' -> [0] '+-*'");
|
||||
t.is (items[1], "a+b", "split ' +-* a+b 12.3e4 'c d'' -> [1] 'a+b'");
|
||||
t.is (items[2], "12.3e4", "split ' +-* a+b 12.3e4 'c d'' -> [2] '12.3e4'");
|
||||
t.is (items[3], "c d", "split ' +-* a+b 12.3e4 'c d'' -> [3] 'c d'");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue