Skip to content

Commit f6e147b

Browse files
test(shell): 兼容源码契约测试换行符 / Make source contract tests line-ending agnostic
中文: - 读取 Shell 集成契约引用的源码后移除回车符 - 避免 Windows CI 的 CRLF 检出导致多行断言误报 English: - Remove carriage returns after reading sources used by shell integration contract checks - Prevent CRLF checkouts in Windows CI from causing false failures in multiline assertions 验证 / Validation: - scripts/test.bat(76/76 通过 / 76/76 passed)
1 parent 53d3842 commit f6e147b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎tests/shell_integration_contract_tests.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <algorithm>
12
#include <filesystem>
23
#include <fstream>
34
#include <iostream>
@@ -24,7 +25,9 @@ std::string ReadFile(const std::filesystem::path& path)
2425
return {};
2526
std::ostringstream contents;
2627
contents << file.rdbuf();
27-
return contents.str();
28+
std::string source = contents.str();
29+
source.erase(std::remove(source.begin(), source.end(), '\r'), source.end());
30+
return source;
2831
}
2932

3033
std::string_view FunctionBody(std::string_view source,

0 commit comments

Comments
 (0)