Text Handling

- Migrated the splitq implementation over to the Lexer. Now it handles all
  Unicode spaces.  Jsut need to obsolete the old version.
This commit is contained in:
Paul Beckingham
2014-04-23 17:34:07 -04:00
parent 45453de477
commit d099a4edfd
3 changed files with 28 additions and 1 deletions

View File

@@ -37,7 +37,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (264);
UnitTest t (270);
// Ensure environment has no influence.
unsetenv ("TASKDATA");
@@ -183,6 +183,16 @@ int main (int argc, char** argv)
t.is (items[4], "five six seven", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [4] 'five six seven'");
t.is (items[5], "eight'nine ten'", "splitq 'one \\'two\\' \\'\\' \\'three four\\' \"five six seven\" eight'nine ten' -> [4] 'eight\\'nine ten\\''");
// void splitq (std::vector<std::string>&, const std::string&);
unsplit = " ( A or B ) ";
splitq (items, unsplit);
t.is (items.size (), (size_t) 5, "splitq ' ( A or B ) '");
t.is (items[0], "(", "splitq ' ( A or B ) ' -> [0] '('");
t.is (items[1], "A", "splitq ' ( A or B ) ' -> [1] 'A'");
t.is (items[2], "or", "splitq ' ( A or B ) ' -> [2] 'or'");
t.is (items[3], "B", "splitq ' ( A or B ) ' -> [3] 'B'");
t.is (items[4], ")", "splitq ' ( A or B ) ' -> [4] ')'");
// void join (std::string& result, const std::string& separator, const std::vector<std::string>& items)
std::vector <std::string> unjoined;
std::string joined;