1、自动测试我的项目。
2、能应付相依赖erl文件的编译。
3、rake的默认任务就是自动测试。
task :default => [:test_all]
task :test_all =>[:init_unit_test,:complie] do |t|
beams = FileList["./bin/*.beam"]
beams.each do |b|
base_name = File.basename(b,".beam")
if base_name =~ /test_*/
puts "running #{base_name}..."
puts(sh "erl -noshell -s #{base_name} main -s init stop")
end
end
end
结果:
exist ./test/test_area_server.erl!
exist ./test/test_dist_demo.erl!
exist ./test/test_hello.erl!
exist ./test/test_kvs.erl!
complie ./srcs/area_server.erl
complie ./srcs/dist_demo.erl
complie ./srcs/hello.erl
complie ./srcs/kvs.erl
complie ./test/test_area_server.erl
complie ./test/test_dist_demo.erl
complie ./test/test_hello.erl
complie ./test/test_kvs.erl
running test_area_server...
true
running test_dist_demo...
true
running test_hello...
true
running test_kvs...
true
1、自动测试我的项目。
2、能应付相依赖erl文件的编译。
3、rake的默认任务就是自动测试。