@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import subprocess
|
||||
import tarfile
|
||||
import tempfile
|
||||
import unittest
|
||||
@@ -63,6 +64,43 @@ class VendorLibghosttyVtTests(unittest.TestCase):
|
||||
self.assertIn('"dist_archive"', text)
|
||||
self.assertIn('"extracted_dir"', text)
|
||||
|
||||
def test_local_vendor_patches_are_listed_in_patch_index(self) -> None:
|
||||
project_root = Path(__file__).resolve().parent.parent
|
||||
index = project_root / "vendor" / "libghostty-vt.patches.md"
|
||||
patch_dir = project_root / "vendor" / "patches" / "libghostty-vt"
|
||||
patches = sorted(patch_dir.glob("*.patch"))
|
||||
|
||||
if not patches:
|
||||
return
|
||||
|
||||
self.assertTrue(index.exists())
|
||||
text = index.read_text()
|
||||
missing = [
|
||||
str(path.relative_to(project_root))
|
||||
for path in patches
|
||||
if str(path.relative_to(project_root)) not in text
|
||||
]
|
||||
self.assertEqual(missing, [])
|
||||
|
||||
def test_local_vendor_patches_are_applied_to_vendored_tree(self) -> None:
|
||||
project_root = Path(__file__).resolve().parent.parent
|
||||
patch_dir = project_root / "vendor" / "patches" / "libghostty-vt"
|
||||
|
||||
for patch in sorted(patch_dir.glob("*.patch")):
|
||||
result = subprocess.run(
|
||||
["git", "apply", "--check", "--reverse", str(patch.relative_to(project_root))],
|
||||
cwd=project_root,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
)
|
||||
self.assertEqual(
|
||||
result.returncode,
|
||||
0,
|
||||
f"{patch.relative_to(project_root)} is not applied cleanly:\n"
|
||||
f"stdout:\n{result.stdout}\n"
|
||||
f"stderr:\n{result.stderr}",
|
||||
)
|
||||
|
||||
def test_embedded_libghostty_logging_is_silenced(self) -> None:
|
||||
root = Path(__file__).resolve().parent.parent / "vendor" / "libghostty-vt"
|
||||
lib_vt = root / "src" / "lib_vt.zig"
|
||||
|
||||
Reference in New Issue
Block a user