feat(solver-bootstrap): step 0 — harness-self-tests

This commit is contained in:
KOKO\Mimi
2026-07-30 00:02:27 +09:00
parent 026c9eea7c
commit 051434b388
3 changed files with 172 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import pytest
from scripts.msvc_harness.config import load_config
from scripts.msvc_harness.discovery import DiscoveryError, discover_project
from scripts.msvc_harness.models import ProjectKind
def test_discover_project_skips_empty_repository(tmp_path):
result = discover_project(tmp_path, load_config(tmp_path))
assert result.selection is None
def test_discover_project_prefers_cmake(tmp_path):
cmake_lists = tmp_path / "CMakeLists.txt"
cmake_lists.write_text("cmake_minimum_required(VERSION 3.25)\n", encoding="utf-8")
(tmp_path / "fallback.sln").write_text("", encoding="utf-8")
result = discover_project(tmp_path, load_config(tmp_path))
assert result.selection is not None
assert result.selection.kind is ProjectKind.CMAKE
assert result.selection.project_file == cmake_lists
def test_discover_project_rejects_orphan_cpp_project(tmp_path):
(tmp_path / "orphan.cpp").write_text("int value = 0;\n", encoding="utf-8")
with pytest.raises(DiscoveryError, match="C/C\\+\\+ files exist"):
discover_project(tmp_path, load_config(tmp_path))