mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Tests: Added test for empty grammar string
This commit is contained in:
parent
d1e19d3171
commit
59e2b7911b
1 changed files with 15 additions and 3 deletions
|
@ -31,7 +31,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int, char**)
|
||||
{
|
||||
UnitTest t (2);
|
||||
UnitTest t (3);
|
||||
|
||||
// Test loading from a missing file.
|
||||
Grammar g;
|
||||
|
@ -41,13 +41,25 @@ int main (int, char**)
|
|||
try
|
||||
{
|
||||
g.loadFromFile (missing);
|
||||
t.fail ("Grammar::loadFromFile did not notice a missing file");
|
||||
t.fail ("Grammar::loadFromFile accepted a missing file");
|
||||
}
|
||||
catch (std::string s)
|
||||
{
|
||||
t.pass ("Grammar::loadFromFile noticed a file was missing");
|
||||
t.diag (s);
|
||||
t.pass ("Grammar::loadFromFile rejected a missing file");
|
||||
}
|
||||
|
||||
// Test error on parsing an empty grammar.
|
||||
try
|
||||
{
|
||||
g.loadFromString ("");
|
||||
t.fail ("Grammar::loadFromFile accepted an empty grammar");
|
||||
}
|
||||
catch (std::string s)
|
||||
{
|
||||
t.diag (s);
|
||||
t.pass ("Grammar::loadFromFile rejected an empty grammar");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue