F
Francis Hwang
I'm trying to do write test code that involves a mock object throwing
an exception on object destruction if a certain condition isn't met.
(In particular, I want to guarantee that a class that uses DBI calls
@dbh.disconnect.) I've been trying to set a finalizer with
ObjectSpace.define_finalizer, but it seems like the GC doesn't want me
to raise an exception from within a finalizer. Overall I understand --
I probably wouldn't try anything this gnarly in production code -- but
is there any way for me to get around this for test code?
Thanks in advance,
Francis
an exception on object destruction if a certain condition isn't met.
(In particular, I want to guarantee that a class that uses DBI calls
@dbh.disconnect.) I've been trying to set a finalizer with
ObjectSpace.define_finalizer, but it seems like the GC doesn't want me
to raise an exception from within a finalizer. Overall I understand --
I probably wouldn't try anything this gnarly in production code -- but
is there any way for me to get around this for test code?
Thanks in advance,
Francis