tmp
This commit is contained in:
parent
101ef375ef
commit
5c7ee99d43
32 changed files with 232 additions and 2023 deletions
|
|
@ -6,58 +6,59 @@
|
|||
using namespace tp;
|
||||
using namespace obj;
|
||||
|
||||
TEST_DEF_STATIC(Basic) {
|
||||
{
|
||||
Parser parser;
|
||||
SUITE(Parser) {
|
||||
TEST(Basic) {
|
||||
objTestModule.initialize();
|
||||
|
||||
String stream = "";
|
||||
auto res = parser.parse(stream);
|
||||
{
|
||||
Parser parser;
|
||||
|
||||
TEST(!res.isError);
|
||||
String stream = "";
|
||||
auto res = parser.parse(stream);
|
||||
|
||||
delete res.scope;
|
||||
}
|
||||
CHECK(!res.isError);
|
||||
|
||||
{
|
||||
Parser parser;
|
||||
delete res.scope;
|
||||
}
|
||||
|
||||
String stream = "var i = true;";
|
||||
auto res = parser.parse(stream);
|
||||
{
|
||||
Parser parser;
|
||||
|
||||
TEST(!res.isError);
|
||||
String stream = "var i = true;";
|
||||
auto res = parser.parse(stream);
|
||||
|
||||
delete res.scope;
|
||||
}
|
||||
CHECK(!res.isError);
|
||||
|
||||
{
|
||||
Parser parser;
|
||||
delete res.scope;
|
||||
}
|
||||
|
||||
String stream = "var i = true; print (i + 1) * 10;";
|
||||
auto res = parser.parse(stream);
|
||||
{
|
||||
Parser parser;
|
||||
|
||||
TEST(!res.isError);
|
||||
String stream = "var i = true; print (i + 1) * 10;";
|
||||
auto res = parser.parse(stream);
|
||||
|
||||
delete res.scope;
|
||||
}
|
||||
}
|
||||
CHECK(!res.isError);
|
||||
|
||||
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) {
|
||||
if (objTestModule.initialize()) {
|
||||
|
||||
testBasic();
|
||||
testErrorHandling();
|
||||
delete res.scope;
|
||||
}
|
||||
|
||||
objTestModule.deinitialize();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ErrorHandling) {
|
||||
objTestModule.initialize();
|
||||
|
||||
{
|
||||
Parser parser;
|
||||
String stream = "var i = true; print (i + 1) * 10; invalidCharacter ";
|
||||
auto res = parser.parse(stream);
|
||||
|
||||
CHECK(res.isError);
|
||||
|
||||
delete res.scope;
|
||||
}
|
||||
|
||||
objTestModule.deinitialize();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue