Support getting line for diagnostic
This commit is contained in:
@@ -23,8 +23,24 @@ TEST_CASE( "Diagnostic invalid token", "[integration]" ) {
|
||||
CHECK(diags[0].GetCode() == Diagnostics::DiagnosticCode::UnexpectedToken);
|
||||
CHECK(diags[0].GetStartPosition() == 3);
|
||||
CHECK(diags[0].GetLength() == 1);
|
||||
CHECK(script->Diagnostics->GetLineFromPosition(diags[0].GetStartPosition()) == 0);
|
||||
delete script;
|
||||
}
|
||||
|
||||
TEST_CASE( "Get diagnostic line", "[integration]" ) {
|
||||
auto script = Script::Create(uR"(
|
||||
1 +/ 1
|
||||
)");
|
||||
REQUIRE(script->Diagnostics -> HasErrors());
|
||||
auto diags = script->Diagnostics -> GetDiagnostics();
|
||||
REQUIRE(diags.size() == 1);
|
||||
CHECK(diags[0].GetCode() == Diagnostics::DiagnosticCode::UnexpectedToken);
|
||||
CHECK(diags[0].GetStartPosition() == 4);
|
||||
CHECK(diags[0].GetLength() == 1);
|
||||
CHECK(script->Diagnostics->GetLineFromPosition(diags[0].GetStartPosition()) == 1);
|
||||
delete script;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user