mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Test: Added Lexer::dequote tests
This commit is contained in:
parent
f1651862a0
commit
d4b450bc53
1 changed files with 14 additions and 1 deletions
|
@ -37,7 +37,7 @@ Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (1170);
|
||||
UnitTest t (1173);
|
||||
|
||||
std::vector <std::pair <std::string, Lexer::Type>> tokens;
|
||||
std::string token;
|
||||
|
@ -93,6 +93,19 @@ int main (int argc, char** argv)
|
|||
t.ok (Lexer::wasQuoted ("a b"), "'a b' --> wasQuoted");
|
||||
t.ok (Lexer::wasQuoted ("(a)"), "'(a)' --> wasQuoted");
|
||||
|
||||
// static bool Lexer::dequote (std::string&, const std::string& quotes = "'\"");
|
||||
token = "foo";
|
||||
Lexer::dequote (token);
|
||||
t.is (token, "foo", "dequote foo --> foo");
|
||||
|
||||
token = "'foo'";
|
||||
Lexer::dequote (token);
|
||||
t.is (token, "foo", "dequote 'foo' --> foo");
|
||||
|
||||
token = "'o\\'clock'";
|
||||
Lexer::dequote (token);
|
||||
t.is (token, "o\\'clock", "dequote 'o\\'clock' --> o\\'clock");
|
||||
|
||||
// Should result in no tokens.
|
||||
Lexer l0 ("");
|
||||
t.notok (l0.token (token, type), "'' --> no tokens");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue