| 24 | } |
| 25 | |
| 26 | bool 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 | |
| 47 | void TestHelper::CollectLuaFile(std::filesystem::path directoryPath, std::vector<std::string> &paths, |
| 48 | std::filesystem::path &root) { |
nothing calls this directly
no test coverage detected