diff --git a/gdb-port/tests/unit/top-level-parse.py b/gdb-port/tests/unit/top-level-parse.py index b0a5692ea57264a736fce692a2b59b1f758c8db2..cbd38f6feb996c75211d9c21319331b01fd2dfe6 100644 --- a/gdb-port/tests/unit/top-level-parse.py +++ b/gdb-port/tests/unit/top-level-parse.py @@ -68,6 +68,16 @@ class TopLevelParseStateManagement(unittest.TestCase): def test_return_from_lowlevel_parse(self): pass + # TODO: This is closer to an integration test: when enter_h_arena_malloc_raw is called, the allocation + # is added to the parser on top of the stack of stacks. + # Testing here that after calling enter_h_do_parse, then enter_h_arena_malloc_raw + # the latter will attribute the allocation to the parser we just set + def test_enter_h_arena_malloc_raw_top_of_stack(self): + self.top_level_parse.parser_stacks.append(self.ps1) + self.top_level_parse.enter_h_do_parse(16, 40, self.parser1.address) + self.top_level_parse.enter_h_arena_malloc_raw(256) + self.assertEqual(self.parser1.bytes_used[40], 256) + def test_enter_h_arena_malloc_raw(self): self.top_level_parse.parser_stacks.append(self.ps1) self.top_level_parse.parser_objs[32] = self.parser1