Fixed an internal error happening when a librrary isn't registered and destroyed by the GC

This commit is contained in:
Matthias Koefferlein
2020-08-30 11:35:30 +02:00
parent 79d3676257
commit eccbb9884c
6 changed files with 48 additions and 19 deletions
+14 -2
View File
@@ -35,11 +35,19 @@ class DBLibrary_TestClass < TestBase
lib.register("RBA-unit-test")
assert_equal(lib.name, "RBA-unit-test")
assert_equal(lib.id != 0, true)
lib_id = lib.id
assert_equal(lib_id != 0, true)
assert_equal(RBA::Library::library_names.member?("RBA-unit-test"), true)
assert_equal(RBA::Library::library_by_name("RBA-unit-test").id, lib.id)
assert_equal(RBA::Library::library_by_name("RBA-unit-test").id, lib_id)
# destroy should not do anything as libraries are not to be removed through the destructor
lib._destroy
assert_equal(RBA::Library::library_by_name("RBA-unit-test").id, lib_id)
assert_equal(lib.destroyed?, true)
lib = RBA::Library::library_by_name("RBA-unit-test")
assert_equal(lib.destroyed?, false)
lib.delete
assert_equal(RBA::Library::library_by_name("RBA-unit-test"), nil)
@@ -85,6 +93,10 @@ class DBLibrary_TestClass < TestBase
lib.layout.create_cell("X")
assert_equal(lib.layout.top_cell.name, "X")
# this will actually destroy the library as it is not registered
lib._destroy
assert_equal(lib.destroyed?, true)
end
end