Re: New assertions in Ruby

2008-02-14 Thread Yuval Kogman
On Tue, Feb 12, 2008 at 16:10:28 -0800, Michael G Schwern wrote: > It's an interesting idea, but at the end of the article is the Fine Print > about how assert {2.0} doesn't quite work: Actually, by rewriting the expressions like I suggested, we can work around that too: my $foo = "";

Re: New assertions in Ruby

2008-02-13 Thread Michael G Schwern
Adrian Howard wrote: which isn't _too_ shabby, but doesn't help much with things like: ok_if { Foo->new->answer == 42 }; or ok_if { $Some_dynamic_var == 42 }; So I don't really think it's worth pursuing. Well, if we follow the logic of the assert2 author, you're just being SLOPPY u

Re: New assertions in Ruby

2008-02-13 Thread Adrian Howard
On 13 Feb 2008, at 00:10, Michael G Schwern wrote: [snip] Data::Dump::Streamer can decompile a code reference, complete with attached lexicals. But as has been pointed out by Yuval, the real trick is to show the value of all variables used in the block. [snip] Yeah... hadn't considered glo

Re: New assertions in Ruby

2008-02-12 Thread Michael G Schwern
chromatic wrote: On Tuesday 12 February 2008 10:55:21 chromatic wrote: On Tuesday 12 February 2008 10:06:14 Eric Wilhelm wrote: How will you print the assertion code without a source filter? "Show Source on Exception" is fairly easy: http://www.oreillynet.com/onlamp/blog/2007/10/adding_show_

Re: New assertions in Ruby

2008-02-12 Thread chromatic
On Tuesday 12 February 2008 10:55:21 chromatic wrote: > On Tuesday 12 February 2008 10:06:14 Eric Wilhelm wrote: > > How will you print the assertion code without a source filter? > > "Show Source on Exception" is fairly easy: > > http://www.oreillynet.com/onlamp/blog/2007/10/adding_show_source_to

Re: New assertions in Ruby

2008-02-12 Thread Yuval Kogman
It's not really the just the source he's showing though, it's the source of the subexpressions leading to the failure of the last expression. Working on the string level is even more confusing in this case, it's beyond just parsing perl without losing sanity, you must also reconstruct it. I have

Re: New assertions in Ruby

2008-02-12 Thread chromatic
On Tuesday 12 February 2008 10:06:14 Eric Wilhelm wrote: > How will you print the assertion code without a source filter? "Show Source on Exception" is fairly easy: http://www.oreillynet.com/onlamp/blog/2007/10/adding_show_source_to_perl_exc.html Making that work with anonymous functions is tri

Re: New assertions in Ruby

2008-02-12 Thread Eric Wilhelm
# from Adrian Howard # on Tuesday 12 February 2008 03:38: >Been considering doing something like for T::E (by de-compiling the   >coderef passed). Could be made more generic I guess. How will you print the assertion code without a source filter? --Eric -- "...the bourgeoisie were hated from bot

Re: New assertions in Ruby

2008-02-12 Thread Adrian Howard
On 12 Feb 2008, at 04:52, Andy Lester wrote: Some interesting ideas for how the Ruby folks are now doing their unit testing. http://www.oreillynet.com/ruby/blog/2008/02/assert2.html By "the Ruby Folks" you mean "Phlip" I think - not seen a mad adoption of it yet :-) Been considering do

New assertions in Ruby

2008-02-11 Thread Andy Lester
Some interesting ideas for how the Ruby folks are now doing their unit testing. http://www.oreillynet.com/ruby/blog/2008/02/assert2.html xoxo, Andy -- Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance