Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
checkraisefold committed Oct 29, 2024
1 parent 1e5efd8 commit 4df54c1
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions tests/TypeInfer.definitions.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,7 @@ TEST_CASE_FIXTURE(Fixture, "class_definition_indexer")

TEST_CASE_FIXTURE(Fixture, "class_definitions_reference_other_classes")
{
unfreeze(frontend.globals.globalTypes);
LoadDefinitionFileResult result = frontend.loadDefinitionFile(
frontend.globals,
frontend.globals.globalScope,
R"(
loadDefinition(R"(
declare class Channel
Messages: { Message }
OnMessage: (message: Message) -> ()
Expand All @@ -486,13 +482,19 @@ TEST_CASE_FIXTURE(Fixture, "class_definitions_reference_other_classes")
Text: string
Channel: Channel
end
)",
"@test",
/* captureComments */ false
);
freeze(frontend.globals.globalTypes);
)");

REQUIRE(result.success);
CheckResult result = check(R"(
local a: Channel
local b = a.Messages[1]
local c = b.Channel
)");

LUAU_REQUIRE_NO_ERRORS(result);

CHECK_EQ(toString(requireType("a")), "Channel");
CHECK_EQ(toString(requireType("b")), "Message");
CHECK_EQ(toString(requireType("c")), "Channel");
}

TEST_CASE_FIXTURE(Fixture, "definition_file_has_source_module_name_set")
Expand Down

0 comments on commit 4df54c1

Please sign in to comment.