parser error handling

This commit is contained in:
IlyaShurupov 2024-03-06 17:31:17 +03:00 committed by Ilusha
parent fdb861b299
commit 49c67eb028
10 changed files with 119 additions and 72 deletions

View file

@ -42,7 +42,7 @@ if (i == 10) {
auto script = R"(
var i = 10;
print (i + 10) * 5;
print i;
)";
TEST_DEF_STATIC(Complex) {

View file

@ -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();
}

View file

@ -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();
}