Formulae can't install to ~/Library/Fonts/ due to Homebrew sandboxing. Casks have a built-in `font` artifact that handles this automatically. - Replace Formula/ with Casks/ directory - Rewrite generator to produce cask files instead of formulae - Add .ttc (TrueType Collection) support - Update all tests for cask format - Update CLI and documentation - Fonts with no installable files (TTF/OTF/TTC) are skipped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
994 B
Python
25 lines
994 B
Python
"""Verify that each font's cask references valid font files that exist."""
|
|
import re
|
|
|
|
import pytest
|
|
|
|
from tests.conftest import CASKS_DIR, FONT_FILES_DIR, get_font_dir_names
|
|
|
|
|
|
@pytest.mark.parametrize("font_name", get_font_dir_names())
|
|
def test_cask_font_artifacts_are_installable(font_name):
|
|
"""Each font artifact in the cask points to a real TTF or OTF file."""
|
|
cask_path = CASKS_DIR / f"{font_name}.rb"
|
|
if not cask_path.exists():
|
|
pytest.skip(f"No cask for {font_name} (no TTF/OTF files)")
|
|
|
|
content = cask_path.read_text()
|
|
paths = re.findall(r'^\s*font\s+"([^"]+)"', content, re.MULTILINE)
|
|
assert paths, f"{font_name}: cask has no font artifacts"
|
|
|
|
for rel_path in paths:
|
|
full_path = FONT_FILES_DIR.parent / rel_path
|
|
assert full_path.is_file(), f"{font_name}: missing font file: {rel_path}"
|
|
assert full_path.suffix.lower() in (".ttf", ".otf", ".ttc"), (
|
|
f"{font_name}: unexpected font type: {full_path.suffix}"
|
|
)
|