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 2008/08/11 21:02:06 UTC

svn commit: r684876 - in /incubator/buildr/trunk: CHANGELOG lib/buildr/core/test.rb spec/test_spec.rb

Author: assaf
Date: Mon Aug 11 12:02:06 2008
New Revision: 684876

URL: http://svn.apache.org/viewvc?rev=684876&view=rev
Log:
* Fixed:  BUILDR-126  Tests options are shared between unrelated projects when using #options instead of #using (Lacton).

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/core/test.rb
    incubator/buildr/trunk/spec/test_spec.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=684876&r1=684875&r2=684876&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Mon Aug 11 12:02:06 2008
@@ -1,30 +1,33 @@
 1.3.3 (Pending)
-* Fixed: BUILDR-119 Eclipse task does not accept test resource folders
-         (Lacton)
-* Fixed: BUILDR-117 Shared directory for both code and resources produces 
-  duplicate Eclipse classpath entries  (Nathan Hamblen)
-* Added: Growl notifications (OS X only).
-* Added: error, info and trace methods.
-* Changed: Error reporting now shows 'buildr aborted!' (used to say rake),
-more of the stack trace without running --trace, and when running with
-supported terminal, error message is red.
-* Changed: BUILDR-104 Buildr::group has :under and :version, but not :type.
-Now it has :type too (Lacton).
-* Fixed: BUILDR-106 download(artifact(...)=>url) broken in certain cases
-(Lacton).
-* Fixed: BUILDR-108 Trace to explain why a compile is done (Lacton).
-* Fixed: BUILDR-109 Failure of "Buildr::Filter should respond to :include and
-use these inclusion patterns" (Lacton).
-* Fixed: BUILDR-110 Error creating buildfile from POM when missing plugin
-configuration (Geoffrey Ruscoe).
-* Fixed: BUILDR-112 Using a user gem repository with 'rake setup' (Lacton).
-* Fixed: BUILDR-114 Hash.from_java_properties does not behave
-like java.util.Properties (Lacton).
-* Fixed: BUILDR-116: TestTask should include the main compile target in its
-dependencies, even when using non standard directories (Lacton).
-* Fixed: BUILDR-124 unzip(...).from_path does not work correctly without include (Rhett Sutphin).
-* Docs: BUILDR-111 Troubleshoot tip when Buildr's bin directory shows up in
-RUBYLIB (Geoffrey Ruscoe).
+* Added:  Growl notifications (OS X only).
+* Added:  error, info and trace methods.
+* Change: Error reporting now shows 'buildr aborted!' (used to say rake),
+          more of the stack trace without running --trace, and when running
+          with supported terminal, error message is red.
+* Change: BUILDR-104 Buildr::group has :under and :version, but not :type.
+          Now it has :type too (Lacton).
+* Fixed:  BUILDR-106 download(artifact(...)=>url) broken in certain cases
+          (Lacton).
+* Fixed:  BUILDR-108 Trace to explain why a compile is done (Lacton).
+* Fixed:  BUILDR-109 Failure of "Buildr::Filter should respond to :include and
+          use these inclusion patterns" (Lacton).
+* Fixed:  BUILDR-110 Error creating buildfile from POM when missing plugin
+          configuration (Geoffrey Ruscoe).
+* Fixed:  BUILDR-112 Using a user gem repository with 'rake setup' (Lacton).
+* Fixed:  BUILDR-114 Hash.from_java_properties does not behave
+          like java.util.Properties (Lacton).
+* Fixed:  BUILDR-117 Shared directory for both code and resources produces 
+          duplicate Eclipse classpath entries (Nathan Hamblen)
+* Fixed:  BUILDR-116: TestTask should include the main compile target in its
+          dependencies, even when using non standard directories (Lacton).
+* Fixed:  BUILDR-119 Eclipse task does not accept test resource folders
+          (Lacton)
+* Fixed:  BUILDR-124 unzip(...).from_path does not work correctly without
+          include (Rhett Sutphin).
+* Fixed:  BUILDR-126  Tests options are shared between unrelated projects when
+          using #options instead of #using (Lacton).
+* Docs:   BUILDR-111 Troubleshoot tip when Buildr's bin directory shows up in
+          RUBYLIB (Geoffrey Ruscoe).
 
 1.3.2 (2008-07-18)
 * Added: --prereqs command line argument to show all tasks and their

Modified: incubator/buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/test.rb?rev=684876&r1=684875&r2=684876&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/test.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/test.rb Mon Aug 11 12:02:06 2008
@@ -179,7 +179,9 @@
     end
 
     # Default options already set on each test task.
-    DEFAULT_OPTIONS = { :fail_on_failure=>true, :fork=>:once, :properties=>{}, :environment=>{} }
+    def default_options
+      { :fail_on_failure=>true, :fork=>:once, :properties=>{}, :environment=>{} }
+    end
 
     def initialize(*args) #:nodoc:
       super
@@ -188,9 +190,9 @@
       @exclude = []
       parent_task = Project.parent_task(name)
       if parent_task.respond_to?(:options)
-        @options = OpenObject.new { |hash, key| parent_task.options[key] }
+        @options = OpenObject.new { |hash, key| parent_task.options[key].clone rescue parent_task.options[key] }
       else
-        @options = OpenObject.new(DEFAULT_OPTIONS)
+        @options = OpenObject.new(default_options)
       end
       enhance do
         run_tests if framework

Modified: incubator/buildr/trunk/spec/test_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/test_spec.rb?rev=684876&r1=684875&r2=684876&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/test_spec.rb (original)
+++ incubator/buildr/trunk/spec/test_spec.rb Mon Aug 11 12:02:06 2008
@@ -413,7 +413,7 @@
     end
   end
 
-  it 'should clone options from parent project' do
+  it 'should clone options from parent project when using #using' do
     define 'foo' do
       define 'bar' do
         test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
@@ -421,8 +421,33 @@
       end.invoke
       test.options[:fail_on_failure].should be_true
       test.options[:fork].should == :once
-      test.options[:properties].should be_empty
-      test.options[:environment].should be_empty
+      test.options[:properties].should == {}
+      test.options[:environment].should == {}
+    end
+  end
+  
+  it 'should clone options from parent project when using #options' do
+    define 'foo' do
+      define 'bar' do
+        test.options[:fail_on_failure] = false
+        test.options[:fork] = :each
+        test.options[:properties][:foo] = 'bar'
+        test.options[:environment]['config'] = 'config.yaml'
+        test.using :junit
+      end.invoke
+      test.options[:fail_on_failure].should be_true
+      test.options[:fork].should == :once
+      test.options[:properties].should == {}
+      test.options[:environment].should == {}
+    end
+  end
+  
+  it 'should not change options of unrelated projects when using #options' do
+    define 'foo' do
+      test.options[:properties][:foo] = 'bar'
+    end
+    define 'bar' do
+      test.options[:properties].should == {}
     end
   end
 end