parser error handling
This commit is contained in:
parent
fdb861b299
commit
49c67eb028
10 changed files with 119 additions and 72 deletions
|
|
@ -42,7 +42,7 @@ if (i == 10) {
|
|||
|
||||
auto script = R"(
|
||||
var i = 10;
|
||||
print (i + 10) * 5;
|
||||
print i;
|
||||
)";
|
||||
|
||||
TEST_DEF_STATIC(Complex) {
|
||||
|
|
|
|||
|
|
@ -17,4 +17,18 @@ TEST_DEF_STATIC(Basic) {
|
|||
delete res.scope;
|
||||
}
|
||||
|
||||
TEST_DEF(Parser) { testBasic(); }
|
||||
TEST_DEF_STATIC(ErrorHandling) {
|
||||
Parser parser;
|
||||
|
||||
String stream = "var i = true; print (i + 1) * 10; invalidCharacter ";
|
||||
auto res = parser.parse(stream);
|
||||
|
||||
TEST(res.isError);
|
||||
|
||||
delete res.scope;
|
||||
}
|
||||
|
||||
TEST_DEF(Parser) {
|
||||
testBasic();
|
||||
testErrorHandling();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,22 +17,12 @@ int main() {
|
|||
tp::ModuleManifest module("ObjectsTests", nullptr, nullptr, deps);
|
||||
|
||||
if (module.initialize()) {
|
||||
|
||||
testParser();
|
||||
module.deinitialize();
|
||||
}
|
||||
// testCore();
|
||||
// testPrimitives();
|
||||
// testInterpreter();
|
||||
|
||||
if (module.initialize()) {
|
||||
testCore();
|
||||
module.deinitialize();
|
||||
}
|
||||
|
||||
if (module.initialize()) {
|
||||
testPrimitives();
|
||||
module.deinitialize();
|
||||
}
|
||||
|
||||
if (module.initialize()) {
|
||||
testInterpreter();
|
||||
module.deinitialize();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue