Return a lexer error on unexpected input - close #3
This commit is contained in:
1 parent
ecef933255
commit
83a4037740
2 files changed
+42
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import testparser;
|
||||
import std.stdio;
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
string input = `x`;
|
||||
auto parser = new Testparser.Parser(input);
|
||||
assert(parser.parse() == Testparser.P_UNEXPECTED_INPUT);
|
||||
|
||||
input = `123`;
|
||||
parser = new Testparser.Parser(input);
|
||||
assert(parser.parse() == Testparser.P_SUCCESS);
|
||||
assert(parser.result == 123u);
|
||||
}
|
||||
Reference in new issue
Block a user