Normalize module-path

Modules indipendant of the path, should only be evaluated once.
This commit is contained in:
phosit
2025-04-03 19:59:05 +02:00
committed by phosit
parent c6d42ebbd5
commit 32ef4fd0fa
4 changed files with 21 additions and 9 deletions
@@ -97,4 +97,21 @@ public:
TS_ASSERT_THROWS(script.GetModuleLoader().LoadModule(rq, "nonexistent.js"),
const std::runtime_error&);
}
void test_EvaluateOnce()
{
ScriptInterface script{"Test", "Test", g_ScriptContext};
const ScriptRequest rq{script};
{
TestLogger logger;
script.GetModuleLoader().LoadModule(rq, "blabbermouth.js");
TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "blah blah blah");
}
{
TestLogger logger;
script.GetModuleLoader().LoadModule(rq, "include/../blabbermouth.js");
TS_ASSERT_STR_NOT_CONTAINS(logger.GetOutput(), "blah blah blah");
}
}
};