Test hook api (#274)

This commit is contained in:
Mark Mossberg
2017-05-25 16:22:08 -04:00
committed by GitHub
parent c2b0617f32
commit 8354ded7e0
+11
View File
@@ -20,6 +20,17 @@ class ManticoreTest(unittest.TestCase):
pass
self.assertTrue(tmp in self.m._hooks[entry])
def test_hook(self):
self.m.context['x'] = 0
@self.m.hook(None)
def tmp(state):
self.m.context['x'] = 1
self.m.terminate()
self.m.run()
self.assertEqual(self.m.context['x'], 1)
def test_hook_dec_err(self):
with self.assertRaises(TypeError):
@self.m.hook('0x00400e40')