Skip to content

Commit

Permalink
Fix a test to test what it's actually intending
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jul 24, 2023
1 parent a863e96 commit eb3bf5a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,29 @@ def test_interrupt_wasm(self):
config.epoch_interruption = True
engine = Engine(config)
store = Store(engine)
store.set_epoch_deadline(1)

module = Module(store.engine, """
(import "" "" (func))
(func
call 0
(import "" "hit" (func $hit))
(import "" "interrupt" (func $interrupt))
(func $start
call $hit
call $interrupt
(loop br 0))
(start 1)
(start $start)
""")
interrupt = Func(store, FuncType([], []), lambda: engine.increment_epoch())

was_hit = False

def hit_callback():
nonlocal was_hit
was_hit = True
hit = Func(store, FuncType([], []), hit_callback)

with self.assertRaises(Trap):
Instance(store, module, [interrupt])
Instance(store, module, [hit, interrupt])
self.assertTrue(was_hit)

def test_fuel(self):
store = Store()
Expand Down

0 comments on commit eb3bf5a

Please sign in to comment.