Skip to content

Commit

Permalink
Added test files for Parser and ExpressionParser
Browse files Browse the repository at this point in the history
  • Loading branch information
loumadev committed Nov 12, 2023
1 parent 4a587b1 commit 9882b80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/compiler/parser/ExpressionParser.test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>

#include "unit.h"
#include "compiler/lexer/Lexer.h"
#include "compiler/parser/Parser.h"


// TODO: Tests for ExpressionParser internals here...
23 changes: 23 additions & 0 deletions test/compiler/parser/Parser.test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

#include "unit.h"
#include "compiler/lexer/Lexer.h"
#include "compiler/parser/Parser.h"


DESCRIBE(variable_declaration, "Variable declaration parsing") {
Lexer lexer;
Lexer_constructor(&lexer);

Parser parser;
Parser_constructor(&parser, &lexer);

ParserResult result;

TEST_BEGIN("Example use of parser") {
Lexer_setSource(&lexer, "let a = 7");
result = Parser_parse(&parser);

EXPECT_TRUE(result.success);
} TEST_END();
}

0 comments on commit 9882b80

Please sign in to comment.