Daniel Berger
6/21/2007 9:01:00 PM
On Jun 21, 2:50 pm, Nobuyoshi Nakada <n...@ruby-lang.org> wrote:
> Hi,
>
> At Fri, 22 Jun 2007 00:44:37 +0900,
> Daniel Berger wrote in [ruby-talk:256413]:
>
> > Is there a way to perform $SAFE checks with test-unit? I tried this
> > with Ruby 1.8.6:
>
> def test_replace_in_safe_mode
> o = {1,2,3,4}
> assert_raise(SecurityError) do
> proc do
> $SAFE = 4
> o.replace({'a', 'b'})
> end.call
> end
> end
Nice, thanks Nobu. Perhaps all assertions should run in anonymous
blocks? It's probably slower, but then I've never cared about the
speed of my unit tests.
Or is there some other downside to doing that?
Regards,
Dan