cli: harden tool output and tests
This commit is contained in:
@@ -26,12 +26,25 @@ namespace {
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::Not;
|
||||
|
||||
std::filesystem::path FindProjectRoot() {
|
||||
std::filesystem::path root = std::filesystem::current_path();
|
||||
while (!root.empty() && root != root.root_path()) {
|
||||
if (std::filesystem::exists(root / "CMakeLists.txt") &&
|
||||
std::filesystem::exists(root / "src" / "cli")) {
|
||||
return root;
|
||||
}
|
||||
root = root.parent_path();
|
||||
}
|
||||
return std::filesystem::current_path();
|
||||
}
|
||||
|
||||
// Test fixture for FileSystemTool tests
|
||||
class FileSystemToolTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// Create test directories and files
|
||||
test_dir_ = std::filesystem::temp_directory_path() / "yaze_fs_tool_test";
|
||||
test_dir_ =
|
||||
FindProjectRoot() / "test_temp" / "yaze_fs_tool_test";
|
||||
std::filesystem::create_directories(test_dir_ / "subdir");
|
||||
|
||||
// Create test files
|
||||
|
||||
@@ -166,7 +166,7 @@ TEST(MemoryAnalyzeToolTest, GetUsageContainsLength) {
|
||||
|
||||
TEST(MemoryAnalyzeToolTest, GetDescriptionIsNotEmpty) {
|
||||
MemoryAnalyzeTool tool;
|
||||
EXPECT_THAT(tool.GetDescription(), Not(HasSubstr("")));
|
||||
EXPECT_FALSE(tool.GetDescription().empty());
|
||||
}
|
||||
|
||||
TEST(MemoryAnalyzeToolTest, DoesNotRequireLabels) {
|
||||
@@ -197,7 +197,7 @@ TEST(MemorySearchToolTest, GetUsageContainsStartEnd) {
|
||||
|
||||
TEST(MemorySearchToolTest, GetDescriptionIsNotEmpty) {
|
||||
MemorySearchTool tool;
|
||||
EXPECT_THAT(tool.GetDescription(), Not(HasSubstr("")));
|
||||
EXPECT_FALSE(tool.GetDescription().empty());
|
||||
}
|
||||
|
||||
TEST(MemorySearchToolTest, DoesNotRequireLabels) {
|
||||
@@ -226,7 +226,7 @@ TEST(MemoryCompareToolTest, GetUsageContainsExpected) {
|
||||
|
||||
TEST(MemoryCompareToolTest, GetDescriptionIsNotEmpty) {
|
||||
MemoryCompareTool tool;
|
||||
EXPECT_THAT(tool.GetDescription(), Not(HasSubstr("")));
|
||||
EXPECT_FALSE(tool.GetDescription().empty());
|
||||
}
|
||||
|
||||
TEST(MemoryCompareToolTest, DoesNotRequireLabels) {
|
||||
@@ -250,7 +250,7 @@ TEST(MemoryCheckToolTest, GetUsageContainsRegion) {
|
||||
|
||||
TEST(MemoryCheckToolTest, GetDescriptionIsNotEmpty) {
|
||||
MemoryCheckTool tool;
|
||||
EXPECT_THAT(tool.GetDescription(), Not(HasSubstr("")));
|
||||
EXPECT_FALSE(tool.GetDescription().empty());
|
||||
}
|
||||
|
||||
TEST(MemoryCheckToolTest, DoesNotRequireLabels) {
|
||||
@@ -279,7 +279,7 @@ TEST(MemoryRegionsToolTest, GetUsageContainsFormat) {
|
||||
|
||||
TEST(MemoryRegionsToolTest, GetDescriptionIsNotEmpty) {
|
||||
MemoryRegionsTool tool;
|
||||
EXPECT_THAT(tool.GetDescription(), Not(HasSubstr("")));
|
||||
EXPECT_FALSE(tool.GetDescription().empty());
|
||||
}
|
||||
|
||||
TEST(MemoryRegionsToolTest, DoesNotRequireLabels) {
|
||||
@@ -359,4 +359,3 @@ TEST(ALTTPMemoryMapTest, SRAMRegionSizeIsCorrect) {
|
||||
} // namespace agent
|
||||
} // namespace cli
|
||||
} // namespace yaze
|
||||
|
||||
|
||||
Reference in New Issue
Block a user