-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathconfigresolver.test.cpp
More file actions
31 lines (24 loc) · 1.12 KB
/
configresolver.test.cpp
File metadata and controls
31 lines (24 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Tests for configuration resolver inheritance and ambiguity.
#include "doctest.h"
#include "luteprojectroot.h"
#include "lute/configresolver.h"
#include "Luau/FileUtils.h"
TEST_CASE("configresolver")
{
std::string root = getLuteProjectRootAbsolute();
std::string baseDir = joinPaths(root, "tests/src/resolver");
std::string file = joinPaths(baseDir, "mainmodule.luau");
// There is a .luaurc in tests/src/resolver; verify resolver reads it without crashing
Luau::LuteConfigResolver configResolver(Luau::Mode::Nonstrict);
const Luau::Config& cfg = configResolver.getConfig(file);
// check that mode was set to strict per .luaurc
CHECK(cfg.mode == Luau::Mode::Strict);
// check the alias root was set
const Luau::Config::AliasInfo* aliasInfo = cfg.aliases.find("root");
CHECK(aliasInfo != nullptr);
CHECK(aliasInfo->value == "./");
// run readConfigRec on parent directory to verify inheritance
const Luau::Config& parentCfg = configResolver.readConfigRec(baseDir);
// mode should be the same as child since no override
CHECK(parentCfg.mode == Luau::Mode::Strict);
}