From: Robert Klemme Date: 2004-12-29T18:46:47+09:00 Subject: Re: unit testing of methods which do Kernel#exit "Michal" schrieb im Newsbeitrag news:20041229093518.GA9138@box.cz... > Hi, > > > Apart from that I would not write tests that do exit the system. > > Usually tests fail with an exception - that should be enough. > > my tests use just assert_* ... but the tested code sometimes exits > using Kernel#exit [well, now I raise SystemExit]. Ah, ok. So you're probably not in the position to change the tested code? If so, I still prefer to use an exception in favour of direct termination. > I have to add that after Nobu's remark I also tried to > assert_raises(SystemExit) while using Kernel#exit and it also > works well. The thing is that now I find "raise SystemExit" more > adequate[*]. > > Regards, > Michal > > Ref: [*]: eh, is this the correct word to convey following in English: > "I like it better and the code seems more 'clear' to me when > using raise"? Disclaimer: I'm not a native speaker. Well, "adequate" is a far more general term. I think I understood what you meant although "adequate" maybe lacks the notion of your personal feelings ("like it better"). I think the term is more factual. You could have also written "I prefer 'raise SystemExit' because it's cleaner". Just a suggestion... :-) Kind regards robert