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

Method TestFormatted

Test/src/TestHelper.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7LuaStyle TestHelper::DefaultStyle;
8
9bool TestHelper::TestFormatted(std::string input, const std::string &shouldBe, LuaStyle &style) {
10 auto file = std::make_shared<LuaSource>(std::move(input));
11 LuaLexer luaLexer(file);
12 luaLexer.Parse();
13
14 LuaParser p(file, std::move(luaLexer.GetTokens()));
15 p.Parse();
16
17 LuaSyntaxTree t;
18 t.BuildTree(p);
19
20 FormatBuilder f(style);
21 auto text = f.GetFormatResult(t);
22
23 return string_util::TrimSpace(text) == string_util::TrimSpace(shouldBe);
24}
25
26bool TestHelper::TestRangeFormatted(std::size_t startLine, std::size_t endLine, std::string input,
27 const std::string &shouldBe, LuaStyle &style) {

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