mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add test case
This commit is contained in:
parent
ae5a011465
commit
c96d7adb83
1 changed files with 28 additions and 3 deletions
|
@ -517,6 +517,29 @@ TEST_CASE_FIXTURE(FrontendFixture, "recheck_if_dependent_script_is_dirty")
|
|||
CHECK_EQ("{| b_value: string |}", toString(*bExports));
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(FrontendFixture, "mark_transitive_deps_as_dirty")
|
||||
{
|
||||
fileResolver.source["game/Gui/Modules/A"] = "return {hello=5, world=true}";
|
||||
fileResolver.source["game/Gui/Modules/B"] = R"(
|
||||
return require(game:GetService('Gui').Modules.A)
|
||||
)";
|
||||
fileResolver.source["game/Gui/Modules/C"] = R"(
|
||||
local Modules = game:GetService('Gui').Modules
|
||||
local B = require(Modules.B)
|
||||
return {c_value = B.hello}
|
||||
)";
|
||||
|
||||
frontend.check("game/Gui/Modules/C");
|
||||
|
||||
std::vector<Luau::ModuleName> markedDirty;
|
||||
frontend.markDirty("game/Gui/Modules/A", &markedDirty);
|
||||
|
||||
REQUIRE(markedDirty.size() == 3);
|
||||
CHECK(std::find(markedDirty.begin(), markedDirty.end(), "game/Gui/Modules/A") != markedDirty.end());
|
||||
CHECK(std::find(markedDirty.begin(), markedDirty.end(), "game/Gui/Modules/B") != markedDirty.end());
|
||||
CHECK(std::find(markedDirty.begin(), markedDirty.end(), "game/Gui/Modules/C") != markedDirty.end());
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Does not work yet. :(
|
||||
TEST_CASE_FIXTURE(FrontendFixture, "recheck_if_dependent_script_has_a_parse_error")
|
||||
|
@ -619,9 +642,11 @@ TEST_CASE_FIXTURE(FrontendFixture, "report_syntax_error_in_required_file")
|
|||
|
||||
CHECK_EQ("Modules/A", result.errors[0].moduleName);
|
||||
|
||||
bool b = std::any_of(begin(result.errors), end(result.errors), [](auto&& e) -> bool {
|
||||
return get<SyntaxError>(e);
|
||||
});
|
||||
bool b = std::any_of(begin(result.errors), end(result.errors),
|
||||
[](auto&& e) -> bool
|
||||
{
|
||||
return get<SyntaxError>(e);
|
||||
});
|
||||
if (!b)
|
||||
{
|
||||
CHECK_MESSAGE(false, "Expected a syntax error!");
|
||||
|
|
Loading…
Add table
Reference in a new issue