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

Add missing tests for ASTNodeDataTypeBuilder

parent 154ed2e1
No related branches found
No related tags found
1 merge request!164Fix function with tuple type in codomain
...@@ -1180,6 +1180,30 @@ let f: R -> X, x -> x; ...@@ -1180,6 +1180,30 @@ let f: R -> X, x -> x;
REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast},
"invalid type identifier, 'X' was previously defined as a 'R'"); "invalid type identifier, 'X' was previously defined as a 'R'");
} }
SECTION("invalid tuple type domain")
{
std::string_view data = R"(
let f: (R) -> R, x -> x;
)";
TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"};
auto ast = ASTBuilder::build(input);
ASTSymbolTableBuilder{*ast};
REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "cannot use tuple (R) as a domain for user functions");
}
SECTION("invalid tuple type in compound domain")
{
std::string_view data = R"(
let f: N*(R^2) -> R, (x,t) -> x;
)";
TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"};
auto ast = ASTBuilder::build(input);
ASTSymbolTableBuilder{*ast};
REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "cannot use tuple (R^2) as a domain for user functions");
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment