mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Added unit test for frontend
This commit is contained in:
parent
91a5c8a67c
commit
bf45aca52e
1 changed files with 23 additions and 0 deletions
|
@ -873,6 +873,29 @@ TEST_CASE_FIXTURE(FrontendFixture, "environments")
|
|||
LUAU_REQUIRE_ERROR_COUNT(1, resultB);
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(FrontendFixture, "global_types_in_scope")
|
||||
{
|
||||
auto& typePaths = configResolver.defaultConfig.globalTypePaths;
|
||||
typePaths.push_back("myTypes");
|
||||
typePaths.push_back("myOtherTypes");
|
||||
|
||||
fileResolver.source["myTypes"] = R"(
|
||||
export type Foo = number | string
|
||||
)";
|
||||
fileResolver.source["myOtherTypes"] = R"(
|
||||
export type Bar = string | boolean
|
||||
)";
|
||||
|
||||
fileResolver.source["A"] = R"(
|
||||
--!nonstrict
|
||||
local foo: Foo = 1
|
||||
local bar: Bar = false
|
||||
)";
|
||||
|
||||
CheckResult result = frontend.check("A");
|
||||
LUAU_REQUIRE_NO_ERRORS(result);
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(FrontendFixture, "ast_node_at_position")
|
||||
{
|
||||
check(R"(
|
||||
|
|
Loading…
Add table
Reference in a new issue