From: Nathaniel Talbott Date: 2002-05-10T06:03:57+09:00 Subject: RE: Test::Unit::Assertions #assert_takes and #assert_takes_nowait (was Re: Thread#join doesn't accept a timeout?) Dossy [mailto:dossy@panoptic.com] wrote: > I just wrote assert_takes_nowait, and slightly rewrote your > assert_takes. Both are posted at the URL I mentioned earlier ... I'll have a look. > > > Nathaniel, I've posted my code (and unit tests) to this URL: > > > > > > http://panoptic.com/ruby > > > > You're a step ahead of me... I hadn't written tests for mine yet :-/ > > Ah, you're not Test Infected, huh? I always try to write > tests for everything, first. It's the XP influence ... :-) I try to be... but we all fail to live up to our ideals now and then, eh? I need to get married and have kids so I can train them to sit by me when I code and go, "Got a test for that? Got a test for that? Got a test for that?" etc. > > That's the only problem with Ruby - it's so easy to write, if you're > > not careful you can end up writing the code before you realize there > > isn't a test for it. At least that's how I rationalize it :-) > > It _is_ really easy to write ... which makes the tests even > easier to write. You know how many hoops you have to jump > through to write tests in other languages ... *grin* Yup, it is easy. You have stripped away all my excuses :-) > > BTW, your code makes me realize that we need better decorator support > > in the framework, both implicit (as proposed earlier by Dave) and > > explicit. I'll add that to the TODO as well. > > Cool. I'd be willing to help out, if I can. Hmmmm.... you can have a look at the thread starting with [ruby-talk:35868] if you're interested in what I'm talking about. I'm probably going to be kind of picky about how this ends up, but you're welcome to start things rolling (as you have here) if you'd like. > Like I said, I posted revised code and tests for assert_takes > and assert_takes_nowait (since I first mentioned the URL) so > you might want to double-check to make sure you saw the > latest versions. One quick comment (haven't looked in depth): there needs to be the ability to specify a message, which was something I neglected in my original version. > Now, time to start working on the load test decorator ... ;-) Go for it! Nathaniel <:((>< + - - | RoleModel Software, Inc. | EQUIP VI