Skip to content

Commit f16f02c

Browse files
sp00ktoberclaude
andcommitted
test(framework): read the event names array to its terminator, not past it
Eight pointers from a seven-entry array segfaulted the test run on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7259463 commit f16f02c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎framework/tests/test_monster_events.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ def test_frame_returns_edges_and_parts(g: Game) -> None:
152152

153153

154154
def test_the_names_are_the_hosts(lib: ctypes.CDLL) -> None:
155-
"""Lua takes a manifest's `on` by these names: they must be mhfu's, kind for kind."""
156-
names = (ctypes.c_char_p * 8).in_dll(lib, "mhfu_monster_event_names")
157-
got = tuple(n.decode() for n in names[: names[:].index(None)])
158-
assert got == monster_events.KINDS
155+
"""Lua takes a manifest's `on` by these names: mhfu's, kind for kind, then a terminator."""
156+
n = len(monster_events.KINDS)
157+
names = (ctypes.c_char_p * (n + 1)).in_dll(lib, "mhfu_monster_event_names")
158+
assert tuple(names[i].decode() for i in range(n)) == monster_events.KINDS
159+
assert names[n] is None

0 commit comments

Comments
 (0)