From: Bill Kelly Date: 2009-03-30T09:30:47+09:00 Subject: Re: testy.rb - ruby testing that's mad at the world From: "ara.t.howard" > > On Mar 29, 2009, at 6:04 PM, Phlip wrote: > >> If only the binding were enough... >> >> You gotta use Ripper to convert the block to opcodes, then eval them >> one by one. > > dude - that is *hardcore* ;-) I think some examples might help. These are from Phlip's January 26, 2008 post Re: assert_{ 2.0 } on the XP list: assert_{ 'a topic' == topics['first'] } output: "a topic" == ( topics["first"] ) --> false topics --> {"first"=>"wrong topic"} ( topics["first"] ) --> "wrong topic". assert_{ [false] == shrew.accessories.map(&:active).uniq } output: [true] == shrew.accessories.map(&:active).uniq --> false shrew --> User 4 shrew.accessories --> [Accessory 501] shrew.accessories.map(&:active) --> [false] shrew.accessories.map(&:active).uniq --> [false]. It's badass. Phlip's work on assert_{ 2.0 } immediately left me with two impressons: 1. Having seen this, why would we ever accept anything less awesome from any testing rig? :) 2. The facilities needed to implement this kind of reflection should be part of ruby core. ....right? :) Regards, Bill