Skip to content

Commit

Permalink
tests: add more local type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bamiaux committed Sep 30, 2018
1 parent 74d1f80 commit 3fd9d5d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion YaLibs/YaToolsIDALib/Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ namespace
// or we can delete our freshly renamed type
for(const auto& r : renames)
{
LOG(DEBUG, "local_type: renamed from %s to %s\n", r.old.c_str(), r.name.c_str());
LOG(DEBUG, "local_type: renamed from %s to %s\n", r.old.c_str(), r.name.c_str());
local_types::rename(r.old.c_str(), r.name.c_str());
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/tests/test_local_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,29 @@ def test_local_types_missing_rename(self):
a.run(
self.check_types(),
)

def test_local_type_overwrite(self):
a, b = self.setup_cmder()

a.run(
self.script(helpers + """
create_local_type("a", "struct { int a; };")
"""),
)
a.check_git(added=["local_type"])

b.run(
self.script(helpers + """
sid = idaapi.add_struc(-1, "b", False)
idc.add_struc_member(sid, "dat", 0, ida_bytes.dword_flag(), -1, 4)
delete_local_type("a")
idaapi.set_struc_name(sid, "a")
"""),
self.save_types(),
)
b.check_git(added=["struc", "strucmember"])

self.types[1] = self.types[1].replace("ordinals: 78", "ordinals: 77") # FIXME
a.run(
self.check_types(),
)

0 comments on commit 3fd9d5d

Please sign in to comment.