More things that should work but don't
parent
0807b75d4b
commit
09e4919509
|
@ -249,25 +249,31 @@ protected:
|
||||||
|
|
||||||
std::string funcName;
|
std::string funcName;
|
||||||
program->GetRunPos(funcName, cursor1, cursor2);
|
program->GetRunPos(funcName, cursor1, cursor2);
|
||||||
|
bool unknown = true;
|
||||||
if (!funcName.empty())
|
if (!funcName.empty())
|
||||||
{
|
{
|
||||||
ss << " while executing function " << funcName << " (" << cursor1 << "-" << (cursor2 >= 0 ? cursor2 : cursor1) << ")" << std::endl << GetFormattedLineInfo(code, cursor1);
|
ss << " while executing function " << funcName << " (" << cursor1 << "-" << (cursor2 >= 0 ? cursor2 : cursor1) << ")" << std::endl << GetFormattedLineInfo(code, cursor1);
|
||||||
|
unknown = false;
|
||||||
}
|
}
|
||||||
else if(e.cursor1 >= 0)
|
else if(e.cursor1 >= 0)
|
||||||
{
|
{
|
||||||
ss << " at unknown location " << e.cursor1 << "-" << (e.cursor2 >= 0 ? e.cursor2 : e.cursor1) << std::endl << GetFormattedLineInfo(code, e.cursor1);
|
ss << " at unknown location " << e.cursor1 << "-" << (e.cursor2 >= 0 ? e.cursor2 : e.cursor1) << std::endl << GetFormattedLineInfo(code, e.cursor1);
|
||||||
|
unknown = false;
|
||||||
}
|
}
|
||||||
ss << std::endl;
|
ss << std::endl;
|
||||||
|
|
||||||
ss << "Variables:" << std::endl;
|
if (!unknown)
|
||||||
int level = 0;
|
|
||||||
while (true)
|
|
||||||
{
|
{
|
||||||
CBotVar* var = program->GetStackVars(funcName, level--);
|
ss << "Variables:" << std::endl;
|
||||||
if (var == nullptr) break;
|
int level = 0;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
CBotVar* var = program->GetStackVars(funcName, level--);
|
||||||
|
if (var == nullptr) break;
|
||||||
|
|
||||||
ss << " Block " << -level << ":" << std::endl;
|
ss << " Block " << -level << ":" << std::endl;
|
||||||
PrintVars(ss, var);
|
PrintVars(ss, var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_FAILURE() << ss.str();
|
ADD_FAILURE() << ss.str();
|
||||||
|
@ -509,6 +515,37 @@ TEST_F(CBotUT, FunctionRedefined)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Doesn't work
|
||||||
|
TEST_F(CBotUT, DISABLED_FunctionBadReturn)
|
||||||
|
{
|
||||||
|
ExecuteTest(
|
||||||
|
"int func()\n"
|
||||||
|
"{\n"
|
||||||
|
" return \"test\";\n"
|
||||||
|
"}\n"
|
||||||
|
"extern void FunctionBadReturn()\n"
|
||||||
|
"{\n"
|
||||||
|
" int a = func();\n"
|
||||||
|
"}\n",
|
||||||
|
static_cast<CBotError>(-1) // TODO: no error for that
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Doesn't work
|
||||||
|
TEST_F(CBotUT, DISABLED_FunctionNoReturn)
|
||||||
|
{
|
||||||
|
ExecuteTest(
|
||||||
|
"int func()\n"
|
||||||
|
"{\n"
|
||||||
|
"}\n"
|
||||||
|
"extern void FunctionNoReturn()\n"
|
||||||
|
"{\n"
|
||||||
|
" func();\n"
|
||||||
|
"}\n",
|
||||||
|
static_cast<CBotError>(-1) // TODO: no error for that
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(CBotUT, ClassConstructor)
|
TEST_F(CBotUT, ClassConstructor)
|
||||||
{
|
{
|
||||||
ExecuteTest(
|
ExecuteTest(
|
||||||
|
@ -570,7 +607,7 @@ TEST_F(CBotUT, DISABLED_ClassDestructorNaming)
|
||||||
"public class TestClass {\n"
|
"public class TestClass {\n"
|
||||||
" public void ~SomethingElse() {}\n"
|
" public void ~SomethingElse() {}\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
static_cast<CBotError>(-1)
|
static_cast<CBotError>(-1) // TODO: no error for that
|
||||||
);
|
);
|
||||||
ExecuteTest(
|
ExecuteTest(
|
||||||
"public class SomethingElse {\n"
|
"public class SomethingElse {\n"
|
||||||
|
@ -578,7 +615,7 @@ TEST_F(CBotUT, DISABLED_ClassDestructorNaming)
|
||||||
"public class TestClass2 {\n"
|
"public class TestClass2 {\n"
|
||||||
" public void ~SomethingElse() {}\n"
|
" public void ~SomethingElse() {}\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
static_cast<CBotError>(-1)
|
static_cast<CBotError>(-1) // TODO: no error for that
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue