spec/build_tests_spec.rb in rscons-0.0.7 vs spec/build_tests_spec.rb in rscons-0.0.8

- old
+ new

@@ -118,9 +118,38 @@ `./build_dir`.should == "Hello from two()\n" File.exists?('build/one/one.o').should be_true File.exists?('build/two/two.o').should be_true end + it 'cleans built files' do + lines = test_dir('build_dir') + `./build_dir`.should == "Hello from two()\n" + File.exists?('build/one/one.o').should be_true + File.exists?('build/two/two.o').should be_true + Rscons.clean + File.exists?('build/one/one.o').should be_false + File.exists?('build/two/two.o').should be_false + File.exists?('build/one').should be_false + File.exists?('build/two').should be_false + File.exists?('build').should be_false + File.exists?('src/one/one.c').should be_true + end + + it 'does not clean created directories if other non-rscons-generated files reside there' do + lines = test_dir('build_dir') + `./build_dir`.should == "Hello from two()\n" + File.exists?('build/one/one.o').should be_true + File.exists?('build/two/two.o').should be_true + File.open('build/two/tmp', 'w') { |fh| fh.puts "dum" } + Rscons.clean + File.exists?('build/one/one.o').should be_false + File.exists?('build/two/two.o').should be_false + File.exists?('build/one').should be_false + File.exists?('build/two').should be_true + File.exists?('build').should be_true + File.exists?('src/one/one.c').should be_true + end + it 'allows Ruby classes as custom builders to be used to construct files' do lines = test_dir('custom_builder') lines.should == ['CC program.o', 'LD program'] File.exists?('inc.h').should be_true `./program`.should == "The value is 5678\n"