Skip to content

Commit d72236d

Browse files
committed
修改测试时的文件赌气
1 parent 76de5ab commit d72236d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Test/src/Performance_unitest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
TEST(FormatPerformance, 1k_row) {
55
auto text = TestHelper::ReadFile("performance/1k_row_code.lua");
6+
EXPECT_TRUE(text.size() != 0);
67
auto p = TestHelper::GetParser(text);
78

89
EXPECT_FALSE(p.HasError());
@@ -16,6 +17,7 @@ TEST(FormatPerformance, 1k_row) {
1617

1718
TEST(FormatPerformance, 10k_row) {
1819
auto text = TestHelper::ReadFile("performance/10k_row_code.lua");
20+
EXPECT_TRUE(text.size() != 0);
1921
auto p = TestHelper::GetParser(text);
2022

2123
EXPECT_FALSE(p.HasError());
@@ -29,6 +31,7 @@ TEST(FormatPerformance, 10k_row) {
2931

3032
TEST(FormatPerformance, 30k_row) {
3133
auto text = TestHelper::ReadFile("performance/30k_row_code.lua");
34+
EXPECT_TRUE(text.size() != 0);
3235
auto p = TestHelper::GetParser(text);
3336

3437
EXPECT_FALSE(p.HasError());
@@ -42,6 +45,7 @@ TEST(FormatPerformance, 30k_row) {
4245

4346
TEST(FormatPerformance, 100k_row) {
4447
auto text = TestHelper::ReadFile("performance/100k_row_code.lua");
48+
EXPECT_TRUE(text.size() != 0);
4549
auto p = TestHelper::GetParser(text);
4650

4751
EXPECT_FALSE(p.HasError());

Test/src/TestHelper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "TestHelper.h"
22
#include "CodeService/RangeFormat/RangeFormatBuilder.h"
3+
#include <filesystem>
34

45
std::string TestHelper::ScriptBase = "";
56

@@ -59,7 +60,8 @@ void TestHelper::CollectLuaFile(std::filesystem::path directoryPath, std::vector
5960
}
6061

6162
std::string TestHelper::ReadFile(const std::string &path) {
62-
std::string newPath = ScriptBase + "/" + path;
63+
std::filesystem::path base(ScriptBase);
64+
std::string newPath = (base / path).string();
6365
#ifdef _WIN32
6466
std::fstream fin(newPath, std::ios::in | std::ios::binary);
6567
#else

0 commit comments

Comments
 (0)