quad/quad-base/test/spec.init.luau
qwreey 325f3f0237
fix(m2): /code-review high 반영 — mock Destroy 의미론(자손·순서·이중 no-op, H-172), lazy claim GC 타이밍(H-171), M7 TweenBrand 잔재(H-173), spec.init 신설; ② H-168~H-170은 round11 §4로
- test/mock.luau: Destroy = Destroying → Parent nil → 자손 재귀 → 연결 해제, 두 번째는 no-op;
  claim이 Destroy된 inst면 새 gcconn 즉시 Disconnect. spec.lifetime 6b/6c 추가.
- test/spec.init.luau: Quad 탑레벨 값 확인을 typechecked 계층으로(smoke.init 5절 제거).
- ROADMAP M7 체크박스·tween-plan: isTween/TweenBrand는 Brand.luau.
- conventions: 규약 요약의 단위 나열 제거(소스는 brief §1). 코드 주석 절 인용을 제목 앞부분으로.
- round11.md: H-168(Ref() 무인자 vs Ref<T>(T)) / H-169(재진입 :Set 옛 value) / H-170(resume이
  에러 삼킴)을 §4 배치 문항으로(권고 전부 (a)), §5에 단위 끝 절차 기록. 세션 원문·요약 갱신.

Co-authored-by: qwreey <me@qwreey.moe>
2026-08-28 19:16:28 +09:00

32 lines
1.5 KiB
Text

--[[
`Quad` 탑레벨 값 존재 확인 — `quad-types`의 `Quad` 타입과 `New()`가 실제로 싣는 값의
드리프트(`ROADMAP.md` M2 `H-80`/`H-25` 부류)를 타입 검사 아래에서 잡는다.
`init.luau`의 `{...} :: Quad` 캐스트는 빠진 필드를 안 잡으므로(실측) 이 런타임 확인이
유일한 가드다 — 그래서 `smoke.*`(analyze 제외)가 아니라 `spec.*`에 둔다.
]]
local Quad = require("../src")
local QuadTypes = require("../roblox_packages/quad_types")
type Quad = QuadTypes.Quad
print("=== 1. New()마다 M2 첫 단위 탑레벨 값이 실려 있음 ===")
do
local m: Quad = Quad.New()
assert(type(m.Relate) == "function" and type(m.Void) == "function" and type(m.Ref) == "function", "Relate/Void/Ref constructors")
local predicates: { (any) -> boolean } = {
m.isEpoch, m.isSource, m.isState, m.isStore, m.isObserver, m.isEffect,
m.isBlocker, m.isModifier, m.isRef, m.isPreRef, m.isPostRef,
}
for i, p in predicates do
assert(type(p) == "function", "predicate #" .. i .. " must be a function")
assert(p({}) == false, "predicate #" .. i .. " is false for an unregistered table")
end
assert(type(m.bindLifetime) == "function" and type(m.unbindLifetime) == "function", "lifetime stubs")
assert(type(m.canBound) == "function" and type(m.canExecute) == "function", "lifetime stubs")
assert(m.Void == Quad.Void and m.Ref == Quad.Ref and m.Relate == Quad.Relate, "leaf modules are shared across instances")
print("PASS")
end
print()
print("=== ALL PASS ===")