Go bindings: add Close() and set as GC finalizer

This commit is contained in:
Ryan Hileman
2015-10-30 21:18:33 -07:00
parent b41db5abd9
commit a6ffb71e4c
2 changed files with 30 additions and 2 deletions

View File

@ -24,3 +24,16 @@ func TestMemUnmap(t *testing.T) {
t.Fatal(fmt.Errorf("Expected ERR_WRITE_UNMAPPED, got: %v", err))
}
}
func TestDoubleClose(t *testing.T) {
mu, err := NewUnicorn(ARCH_X86, MODE_32)
if err != nil {
t.Fatal(err)
}
if err := mu.Close(); err != nil {
t.Fatal(err)
}
if err := mu.Close(); err != nil {
t.Fatal(err)
}
}