Skip to content
Snippets Groups Projects
Commit 5b330b41 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add tests for module import and `let` declaration

parent c9f9368a
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -25,6 +25,21 @@
TEST_CASE("ASTNodeDataTypeBuilder", "[language]")
{
SECTION("module")
{
std::string_view data = R"(
import a_module_name;
)";
std::string_view result = R"(
(root:void)
`-(language::import_instruction:void)
`-(language::module_name:string)
)";
CHECK_AST(data, result);
}
SECTION("integer")
{
std::string_view data = R"(
......@@ -100,6 +115,42 @@ false;
CHECK_AST(data, result);
}
SECTION("let declaration")
{
SECTION("scalar functions")
{
std::string_view data = R"(
let f : R -> R, x -> x;
let g : R*R -> R, (x,y) -> x+y;
)";
std::string_view result = R"(
(root:void)
+-(language::let_declaration:void)
| `-(language::name:f:function)
`-(language::let_declaration:void)
`-(language::name:g:function)
)";
CHECK_AST(data, result);
}
SECTION("scalar functions")
{
std::string_view data = R"(
let f : R -> R, (x) -> x;
)";
std::string_view result = R"(
(root:void)
`-(language::let_declaration:void)
`-(language::name:f:function)
)";
#warning finish this test
// CHECK_AST(data, result);
}
}
SECTION("ostream")
{
std::string_view data = R"(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment