From: Jim Freeze Date: 2003-06-03T12:39:12+09:00 Subject: Re: Unit Testing Style On Tuesday, 3 June 2003 at 12:16:50 +0900, Jim Weirich wrote: > On Mon, 2003-06-02 at 22:15, Jim Freeze wrote: > > On Tuesday, 3 June 2003 at 10:30:00 +0900, Jim Weirich wrote: > > > [...] (usually a separate Rake/Make target). [...] > > > > So Jim, do you have a short example of using rake to > > manage unit tests? > > I am thinking about moving from make to rake so my tests > > will be environment independent (at least it will be easier > > to install rake than make). > > I was wondering if anyone would catch the Rake reference. > > A dirt simple example follows. Assume all of your unit tests are in a > directory named "test" and that your source code is in a directory named > "lib". > > task :test do # Run the Unit Tests > Sys.ruby %{-Ilib -Itest } + > %{-e 'Dir["test/test*.rb"].each { |fn| require fn }'} > end > Thanks for the example. > Truthfully, I'm still learning to use Rake effectively. I've been > limited by Make for so long, it is taking me a while to see some of the > possibilities. > > For example, I'm playing around with a Builder object that is > knowledgable about how a, for example, Ruby project is built. All you > do is specify a few special directories or actions and the Builder will > construct the make targets for you programmatically. I'm watching the > discussion on "standard" project directories closely, because if we can > standardize the directory structure, then more knowledge can be moved > into the Builder. I think the Standard Project Directories discussion has died down. Either we reached a consensus, or wore everyone out. ;) Below is the final state it reached: ------------------ Below is a suggested directory hierarchy. All of the directories, except possibly test/ ;), are optional. Most of the filenames listed are optional but are listed for consistent spelling and capitalization. CHANGELOG INSTALL LICENSE Manifest README # if multi lang, README.en, README.ja, etc TODO # optional install.rb # place holder setup.rb # place holder bin/ # ruby executables # other executables contrib/ # third party contributions doc/ # If multi lang, then use doc.en, doc.ja, etc man/ # for unix man api/ # rdoc output rd/ # if rd based docs tutorial/ example/ ext/ ext_name/ extconf.rb ... other source lib/ # .rb files that go into RUBY_LIB # may want to use parallel directory structure below # site_ruby// src/ / test/ # test suites. Best if dirs mirror lib/. -- Jim Freeze ---------- Common sense is instinct, and enough of it is genius. -- Josh Billings