aboutsummaryrefslogtreecommitdiff
path: root/scripts/test_vendor_libghostty_vt.py
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-16 23:28:05 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-16 23:29:28 +0300
commit4a3302d19a2baa3a33e910e0088c24e780905b90 (patch)
treedcaf76fae1c82102d933c9225b17ca7ac5d3a847 /scripts/test_vendor_libghostty_vt.py
parent550e9f8cc085f428429f5cf2da0bb2dba897e8b8 (diff)
chore: update vendored libghostty-vt
refs #276
Diffstat (limited to 'scripts/test_vendor_libghostty_vt.py')
-rw-r--r--scripts/test_vendor_libghostty_vt.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/scripts/test_vendor_libghostty_vt.py b/scripts/test_vendor_libghostty_vt.py
index 9dcdbb2d..ad5c8d5e 100644
--- a/scripts/test_vendor_libghostty_vt.py
+++ b/scripts/test_vendor_libghostty_vt.py
@@ -8,7 +8,11 @@ import unittest
from pathlib import Path
from unittest import mock
-from scripts.vendor_libghostty_vt import ensure_dist_archive, parse_archive_root
+from scripts.vendor_libghostty_vt import (
+ ensure_dist_archive,
+ parse_archive_root,
+ require_clean_checkout,
+)
class VendorLibghosttyVtTests(unittest.TestCase):
@@ -30,16 +34,44 @@ class VendorLibghosttyVtTests(unittest.TestCase):
dist.mkdir(parents=True)
(dist / "libghostty-vt-1.3.2-main-+deadbeef0.tar.gz").write_bytes(b"stale")
+ def git_output(command: list[str], **_kwargs: object) -> str:
+ if command[1] == "status":
+ return ""
+ return "0123456789abcdef\n"
+
with (
mock.patch("scripts.vendor_libghostty_vt.subprocess.run"),
mock.patch(
"scripts.vendor_libghostty_vt.subprocess.check_output",
- return_value="0123456789abcdef\n",
+ side_effect=git_output,
),
):
with self.assertRaisesRegex(FileNotFoundError, "HEAD 012345678"):
ensure_dist_archive(repo)
+ def test_require_clean_checkout_rejects_tracked_and_untracked_changes(self) -> None:
+ with tempfile.TemporaryDirectory() as temp_dir:
+ repo = Path(temp_dir)
+ with mock.patch(
+ "scripts.vendor_libghostty_vt.subprocess.check_output",
+ return_value=" M src/terminal.zig\n?? local.patch\n",
+ ):
+ with self.assertRaisesRegex(ValueError, "refusing to vendor from dirty checkout"):
+ require_clean_checkout(repo)
+
+ def test_ensure_dist_archive_rejects_checkout_dirtied_by_build(self) -> None:
+ with tempfile.TemporaryDirectory() as temp_dir:
+ repo = Path(temp_dir)
+ with (
+ mock.patch("scripts.vendor_libghostty_vt.subprocess.run"),
+ mock.patch(
+ "scripts.vendor_libghostty_vt.subprocess.check_output",
+ side_effect=["", "0123456789abcdef\n", " M generated.txt\n"],
+ ),
+ ):
+ with self.assertRaisesRegex(ValueError, "refusing to vendor from dirty checkout"):
+ ensure_dist_archive(repo)
+
def test_vendored_tree_contains_required_upstream_files(self) -> None:
root = Path(__file__).resolve().parent.parent / "vendor" / "libghostty-vt"
required = [