MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / TestRangeFormatted

Method TestRangeFormatted

Test/src/TestHelper.cpp:26–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26bool TestHelper::TestRangeFormatted(std::size_t startLine, std::size_t endLine, std::string input,
27 const std::string &shouldBe, LuaStyle &style) {
28 auto file = std::make_shared<LuaSource>(std::move(input));
29 LuaLexer luaLexer(file);
30 luaLexer.Parse();
31
32 LuaParser p(file, std::move(luaLexer.GetTokens()));
33 p.Parse();
34
35 LuaSyntaxTree t;
36 t.BuildTree(p);
37
38 FormatRange range;
39 range.StartLine = startLine;
40 range.EndLine = endLine;
41 RangeFormatBuilder f(style, range);
42 auto text = f.GetFormatResult(t);
43
44 return string_util::TrimSpace(text) == string_util::TrimSpace(shouldBe);
45}
46
47void TestHelper::CollectLuaFile(std::filesystem::path directoryPath, std::vector<std::string> &paths,
48 std::filesystem::path &root) {

Callers

nothing calls this directly

Calls 4

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
ParseMethod · 0.45
GetFormatResultMethod · 0.45

Tested by

no test coverage detected