fix(spreadsheet): 단위 Φ 앞붙이기 — 강제 글 낫표 뒤에 붙임 · 식은 그대로(81-5)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
This commit is contained in:
2026-10-08 13:33:20 +09:00
co-authored by Claude Sonnet 5.5
parent ab3f0fda89
commit a6765f8469
4 changed files with 51 additions and 16 deletions
@@ -66,7 +66,23 @@ def test_Φ_길이_묶음_끝_칸_글_편집기():
assert '["UnitGroup_area", ["㎡", "㎥", "m", "㎝", "㎜", "㎞", "Φ"]]' in src
body = src.split("function insertUnit")[1].split("function renderRecent")[0]
assert "UNIT_PREFIX.includes(unit)" in body
assert (
"now.startsWith(unit)" in body and "unit + now" in body
) # 「300」 → 「Φ300」 · 두 번 안 붙음
assert "const s = front ? 0" in body # 편집 중에도 글 맨 앞
assert "prefixUnit(now, unit)" in body # 칸 글 — 「300」 → 「Φ300」 · 두 번 안 붙음
assert "prefixUnit(active.value, unit)" in body # 편집 중에도 같은 규칙
@pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
def test_앞_단위_글_낫표_뒤에_붙음():
"""강제 글 낫표(`'300`)는 맨 앞에 두고 그 뒤에 붙임 — 「Φ'300」 처럼 낫표가 가운데 남지 않음."""
func = re.search(r"^export function prefixUnit[\s\S]*?^}", _text(), re.M)
assert func
script = (
func.group(0).replace("export ", "").replace(": string", "")
+ """
const f = prefixUnit;
console.log(JSON.stringify([f("300", "Φ"), f("'300", "Φ"), f("Φ300", "Φ"), f("'Φ300", "Φ"), f("=A1", "Φ"), f("", "Φ")]));
"""
)
out = subprocess.run(
["node", "-e", script], capture_output=True, text=True, encoding="utf-8", check=True
)
assert json.loads(out.stdout) == ["Φ300", "'Φ300", "Φ300", "'Φ300", "=A1", "Φ"]