Test::Unit advice - blocking method

Hi all,

I’ve got a method in the win32-clipboard library,
Clipboard.notify_change,
that blocks until something changes in the clipboard. But I’m not sure
how
to test it.

Basically, here’s what I’m trying to accomplish:

def test_notify_change
assert_nothing_raised{ Clipboard.notify_change } # This will block
until something happens
assert_nothing_raised{ Clipboard.set_data(‘test’) } # This should
trigger
the notify_change method
end

I tried using a thread within the test itself but it didn’t work right.
I
was probably doing something wrong.

Any suggestions?

Regards,

Dan

I tried using a thread within the test itself but it didn’t work right.
I
was probably doing something wrong.

Any suggestions?

maybe use 1.9 with thread_blocking_region’s? Maybe use two processes?
Just thinking out loud.
=r

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs