From: Sam Roberts Date: 2005-04-01T09:01:42+09:00 Subject: Re: rake help Quoting probertm@acm.org, on Wed, Mar 30, 2005 at 07:11:05AM +0900: > I have just started using the excellent Rake tool (thanks, Jim!) and I am at a > bit of a loss on how to proceed. I am attempting to create unit test for > some C++ code I am creating, using the cxxtest tool. > > cxxtest has its tests contained in a .h file. These are then parsed by the > tool to give your .cpp file. This is then complied and linked with the > object file. > > So, assuming I have my code in foo.cpp, my tests in foo_test.h, then the > sequence looks like: This is a little off-topic, but you might find that GNU make has had a dozen years of optimization for doing this kind of stuff easily and concisely: --- makefile --- default: test TEST_H = $(wildcard *_test.h) TEST_E = $(TEST_H:.h=) exe: $(TEST_E) test: exe for t in $(TEST_E); do ./$$t; done %.o: %.cpp c++ -c -o $@ $< %_test.cpp: %_test.h cxxtest.pl -o $@ $< %_test: %_test.o %.o c++ -o $@ $^ ---------------- This makefile enforces your naming convention, that the unit test for BAR are in BAR_test.h, and the source is in BAR.cpp I took the liberty of running the tests by default, as all good makefiles should do. Cheers, Sam