Conversation
| using chess::util::strings::TextTable; | ||
|
|
||
| namespace { | ||
| [[nodiscard]] auto get_printed_string(const TextTable& table) -> std::string |
Check notice
Code scanning / CodeQL
Unused static function
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the problem, both the function get_printed_string and the associated test case TEST_CASE("TextTable - to_string() should give same result as print()", TAGS) should be removed from the file tests/unit/libchess/util/TextTable.cpp. This involves removing the entire anonymous namespace containing get_printed_string, and the body of the test case itself. No imports or helper methods are needed as the file will otherwise remain unchanged.
| @@ -21,44 +21,6 @@ | ||
|
|
||
| using chess::util::strings::TextTable; | ||
|
|
||
| namespace { | ||
| [[nodiscard]] auto get_printed_string(const TextTable& table) -> std::string | ||
| { | ||
| std::string result; | ||
|
|
||
| auto appendToString = [&result](const std::string_view toAdd) { | ||
| result.append(toAdd); | ||
| }; | ||
|
|
||
| table.print( | ||
| appendToString, appendToString, appendToString, | ||
| [&result] { result.append(1uz, '\n'); }); | ||
|
|
||
| return result; | ||
| } | ||
| } // namespace | ||
|
|
||
| TEST_CASE("TextTable - to_string() should give same result as print()", TAGS) | ||
| { | ||
| TextTable table; | ||
|
|
||
| table.append_column("Option") | ||
| .append_column("Type") | ||
| .append_column("Notes") | ||
| .append_column("Default"); | ||
|
|
||
| table.new_row() | ||
| .append_column("Option 1") | ||
| .append_column("Integer") | ||
| .append_column("Comments") | ||
| .append_column("0"); | ||
|
|
||
| table.new_row() | ||
| .append_column("Option 2") | ||
| .append_column("String") | ||
| .append_column("More comments") | ||
| .append_column("foo"); | ||
|
|
||
| REQUIRE( | ||
| get_printed_string(table) == table.to_string()); | ||
| } |
| } | ||
| } // namespace | ||
|
|
||
| TEST_CASE("TextTable - to_string() should give same result as print()", TAGS) |
Check notice
Code scanning / CodeQL
Unused static function
Copilot Autofix
AI 4 months ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
TextTable::to_string()vsTextTable::print()