using test suites
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
TEST_SUITE("Lexer") {
|
||||
TEST_CASE("Single character token") {
|
||||
struct test {
|
||||
token::type expectedType;
|
||||
@@ -159,3 +160,4 @@ if (5 < 10) {\
|
||||
REQUIRE(tok.literal == t.expectedLiteral);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -57,6 +57,7 @@ void test_failing_let_parsing(
|
||||
delete program;
|
||||
}
|
||||
|
||||
TEST_SUITE("Parser: let") {
|
||||
TEST_CASE("Malformed let statement (checking for memory leaks)") {
|
||||
SUBCASE("Second token not identifier") {
|
||||
test_failing_let_parsing("let 5 = 5;", {token::type::IDENTIFIER});
|
||||
@@ -82,7 +83,7 @@ TEST_CASE("Malformed let statement (checking for memory leaks)") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Parse let statement") {
|
||||
TEST_CASE("Parse well formed let statements") {
|
||||
std::stringstream input("\
|
||||
let x = 5;\
|
||||
let y = 10;\
|
||||
@@ -120,3 +121,4 @@ let foobar = 103213;\
|
||||
|
||||
delete program;
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include <doctest.h>
|
||||
#include <sstream>
|
||||
|
||||
TEST_SUITE("Parser: return") {
|
||||
TEST_CASE("Parse return statement") {
|
||||
std::stringstream input("\
|
||||
return 5;\
|
||||
@@ -37,3 +38,4 @@ return 103213;\
|
||||
|
||||
delete program;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user