Renames project.

This commit is contained in:
2020-10-05 17:45:00 +02:00
parent 125bb8459c
commit f299d5183f
23 changed files with 197 additions and 67 deletions

View File

@@ -1,11 +1,11 @@
#include "../../extern/doctest.hpp"
#include "../../src/Parser/Lexer/Lexer.hpp"
using namespace ElohimScript::Parser;
using namespace MalachScript::Parser;
#define KEYWORD_TEST(script, symbol) \
TEST_CASE("Lex " script) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(script, script, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \
@@ -92,7 +92,7 @@ namespace doctest {
#define IDENTIFIER_TEST(identifier) \
TEST_CASE("Lex identifier " identifier) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(identifier, identifier, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \

View File

@@ -1,11 +1,11 @@
#include "../../extern/doctest.hpp"
#include "../../src/Parser/Lexer/Lexer.hpp"
using namespace ElohimScript::Parser;
using namespace MalachScript::Parser;
#define LEX_TEST(script, ...) \
TEST_CASE("Lex: " script) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(script, script, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \

View File

@@ -1,11 +1,11 @@
#include "../../extern/doctest.hpp"
#include "../../src/Parser/Lexer/Lexer.hpp"
using namespace ElohimScript::Parser;
using namespace MalachScript::Parser;
#define INTEGER_TEST(script, expected) \
TEST_CASE("Lex " script) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(script, script, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \
@@ -17,7 +17,7 @@ using namespace ElohimScript::Parser;
#define FLOAT_TEST(script, expected) \
TEST_CASE("Lex " script) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(script, script, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \
@@ -72,13 +72,13 @@ INTEGER_TEST("0B110011", 51);
#undef FLOAT_TEST
TEST_CASE("Lex invalid numerical base") {
ElohimScript::Diagnostics::Diagnostics diag;
MalachScript::Diagnostics::Diagnostics diag;
auto lexer = Lexer("bad base", "0f553", &diag);
lexer.Lex();
const auto& messages = diag.GetMessages();
REQUIRE(messages.size() == 1);
CHECK(messages[0].GetType() == ElohimScript::Diagnostics::DiagnosticType::InvalidNumericalBase);
CHECK(messages[0].GetLevel() == ElohimScript::Diagnostics::DiagnosticLevel::Error);
CHECK(messages[0].GetSpan() == ElohimScript::TextSpan(0, 2));
CHECK(messages[0].GetType() == MalachScript::Diagnostics::DiagnosticType::InvalidNumericalBase);
CHECK(messages[0].GetLevel() == MalachScript::Diagnostics::DiagnosticLevel::Error);
CHECK(messages[0].GetSpan() == MalachScript::TextSpan(0, 2));
CHECK(messages[0].GetScriptName() == u8"bad base");
}

View File

@@ -1,11 +1,11 @@
#include "../../extern/doctest.hpp"
#include "../../src/Parser/Lexer/Lexer.hpp"
using namespace ElohimScript::Parser;
using namespace MalachScript::Parser;
#define STRING_TEST(str, constraint) \
TEST_CASE("Lex string " constraint str constraint) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(str, constraint str constraint, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \
@@ -22,7 +22,7 @@ STRING_TEST("\"foo bar\"", "\"\"\"");
STRING_TEST("\"\"foo bar\"\"", "\"\"\"");
TEST_CASE("Lex multiline string") {
ElohimScript::Diagnostics::Diagnostics diag;
MalachScript::Diagnostics::Diagnostics diag;
auto lexer = Lexer("multiline", R"("""foo
bar""")",
&diag);

View File

@@ -2,11 +2,11 @@
#include "../../extern/doctest.hpp"
#include "../../src/Parser/Lexer/Lexer.hpp"
using namespace ElohimScript::Parser;
using namespace MalachScript::Parser;
#define SYMBOL_TEST(script, symbol) \
TEST_CASE("Lex " script) { \
ElohimScript::Diagnostics::Diagnostics diag; \
MalachScript::Diagnostics::Diagnostics diag; \
auto lexer = Lexer(script, script, &diag); \
const auto* token = lexer.Lex(); \
CHECK(diag.GetMessages().empty()); \
@@ -73,7 +73,7 @@ SYMBOL_TEST(" ", Whitespace)
TEST_CASE("Lex whitespace") {
auto whitespace = {" ", "\t", "\n", "\r", "\xef\xbb\xbf"};
for (const auto* v : whitespace) {
ElohimScript::Diagnostics::Diagnostics diag;
MalachScript::Diagnostics::Diagnostics diag;
auto lexer = Lexer("whitespace", v, &diag);
const auto* token = lexer.Lex();
CHECK(diag.GetMessages().empty());