You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2009/02/13 10:13:42 UTC

svn commit: r744045 - in /buildr/trunk: lib/buildr/core/application.rb lib/buildr/core/test.rb spec/core/transport_spec.rb

Author: assaf
Date: Fri Feb 13 09:13:42 2009
New Revision: 744045

URL: http://svn.apache.org/viewvc?rev=744045&view=rev
Log:
Setting RakeFileUtils.verbose_flag to false prevents the annoying messages in every FileUtils method and sh call.
Failure in test framework is now reported and the test allowed to fail properly, rather than miserably.
Fixed failing tests in transport_spec.rb.

Modified:
    buildr/trunk/lib/buildr/core/application.rb
    buildr/trunk/lib/buildr/core/test.rb
    buildr/trunk/spec/core/transport_spec.rb

Modified: buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/application.rb?rev=744045&r1=744044&r2=744045&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/application.rb (original)
+++ buildr/trunk/lib/buildr/core/application.rb Fri Feb 13 09:13:42 2009
@@ -263,6 +263,7 @@
       
       standard_buildr_options.each { |args| opts.on(*args) }
       parsed_argv = opts.parse(ARGV)
+      RakeFileUtils.verbose_flag = options.trace
       parsed_argv
     end
 

Modified: buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/test.rb?rev=744045&r1=744044&r2=744045&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/test.rb (original)
+++ buildr/trunk/lib/buildr/core/test.rb Fri Feb 13 09:13:42 2009
@@ -442,7 +442,13 @@
         @passed_tests, @failed_tests = [], []
       else
         info "Running tests in #{@project.name}"
-        @passed_tests = @framework.run(@tests, dependencies)
+        begin
+          @passed_tests = @framework.run(@tests, dependencies)
+        rescue Exception=>ex
+          error "Test framework error: #{ex.message}"
+          error ex.backtrace if Buildr.application.options.trace
+          @passed_tests = []
+        end
         @failed_tests = @tests - @passed_tests
         unless @failed_tests.empty?
           error "The following tests failed:\n#{@failed_tests.join("\n")}"

Modified: buildr/trunk/spec/core/transport_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/transport_spec.rb?rev=744045&r1=744044&r2=744045&view=diff
==============================================================================
--- buildr/trunk/spec/core/transport_spec.rb (original)
+++ buildr/trunk/spec/core/transport_spec.rb Fri Feb 13 09:13:42 2009
@@ -415,14 +415,14 @@
 
   it 'should read contents of file and return it' do
     file = mock('Net::SFTP::Operations::File')
-    file.should_receive(:read).with(an_instance_of(Numeric)).once.and_return(@content, nil)
+    file.should_receive(:read).with(URI::RW_CHUNK_SIZE).once.and_return(@content, nil)
     @file_factory.should_receive(:open).with('/root/path/readme', 'r').and_yield(file)
     @uri.read.should eql(@content)
   end
 
   it 'should read contents of file and pass it to block' do
     file = mock('Net::SFTP::Operations::File')
-    file.should_receive(:read).with(an_instance_of(Numeric)).once.and_return(@content, nil)
+    file.should_receive(:read).with(URI::RW_CHUNK_SIZE).once.and_return(@content, nil)
     @file_factory.should_receive(:open).with('/root/path/readme', 'r').and_yield(file)
     content = ''
     @uri.read do |chunk|