Reorganized tests
This commit is contained in:
27
tests/integration/diagnostic_tests.cpp
Normal file
27
tests/integration/diagnostic_tests.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch.hpp>
|
||||
#include "../src/Script.hpp"
|
||||
|
||||
TEST_CASE( "Diagnostic invalid character", "[integration]" ) {
|
||||
Script script = Script::Create("1 + 1 @");
|
||||
REQUIRE(script.Diagnostics -> HasErrors());
|
||||
auto diags = script.Diagnostics -> GetDiagnostics();
|
||||
REQUIRE(diags.size() == 1);
|
||||
CHECK(diags[0].GetCode() == DiagnosticCode::UnexpectedCharacter);
|
||||
CHECK(diags[0].GetStartPosition() == 6);
|
||||
CHECK(diags[0].GetLength() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE( "Diagnostic invalid token", "[integration]" ) {
|
||||
Script script = Script::Create("1 +/ 1");
|
||||
REQUIRE(script.Diagnostics -> HasErrors());
|
||||
auto diags = script.Diagnostics -> GetDiagnostics();
|
||||
REQUIRE(diags.size() == 1);
|
||||
CHECK(diags[0].GetCode() == DiagnosticCode::UnexpectedToken);
|
||||
CHECK(diags[0].GetStartPosition() == 3);
|
||||
CHECK(diags[0].GetLength() == 1);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user