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/05/17 03:40:03 UTC
svn commit: r657276 - in /incubator/buildr/trunk: CHANGELOG
lib/buildr/java/test_frameworks.rb spec/java_test_frameworks_spec.rb
spec/test_spec.rb
Author: assaf
Date: Fri May 16 18:40:02 2008
New Revision: 657276
URL: http://svn.apache.org/viewvc?rev=657276&view=rev
Log:
JUnit not passing environment variables from the :environment option.
Modified:
incubator/buildr/trunk/CHANGELOG
incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb
incubator/buildr/trunk/spec/java_test_frameworks_spec.rb
incubator/buildr/trunk/spec/test_spec.rb
Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=657276&r1=657275&r2=657276&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Fri May 16 18:40:02 2008
@@ -5,6 +5,8 @@
* Fixed: BUILDR-68 Now accepting JAVA_HOME setting on OS X (Nathan Hamblen).
* Fixed: JUnit now accepts java_args and passes these arguments to the JVM
(only applicable when forking).
+* Fixed: BUILDR-70 JUnit not passing environment variables fro the
+:environment option.
1.3.0 (2008-04-25)
* Added: Testing with EasyB (Nicolas Modrzyk).
Modified: incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb?rev=657276&r1=657275&r2=657276&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb Fri May 16 18:40:02 2008
@@ -200,7 +200,7 @@
ant.junit forking.merge(:clonevm=>options[:clonevm] || false, :dir=>task.send(:project).path_to) do
ant.classpath :path=>dependencies.join(File::PATH_SEPARATOR)
(options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
- (options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
+ (options[:environment] || []).each { |key, value| ant.env :key=>key, :value=>value }
Array(options[:java_args]).each { |value| ant.jvmarg :value=>value }
ant.formatter :type=>'plain'
ant.formatter :type=>'plain', :usefile=>false # log test
Modified: incubator/buildr/trunk/spec/java_test_frameworks_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/java_test_frameworks_spec.rb?rev=657276&r1=657275&r2=657276&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/java_test_frameworks_spec.rb (original)
+++ incubator/buildr/trunk/spec/java_test_frameworks_spec.rb Fri May 16 18:40:02 2008
@@ -179,6 +179,18 @@
project('foo').test.invoke
end
+ it 'should pass environment to JVM' do
+ write 'src/test/java/EnvironmentTest.java', <<-JAVA
+ public class EnvironmentTest extends junit.framework.TestCase {
+ public void testEnvironment() {
+ assertEquals("value", System.getenv("NAME"));
+ }
+ }
+ JAVA
+ define('foo').test.using :environment=>{ 'NAME'=>'value' }
+ project('foo').test.invoke
+ end
+
it 'should set current directory' do
mkpath 'baz'
expected = File.expand_path('baz')
Modified: incubator/buildr/trunk/spec/test_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/test_spec.rb?rev=657276&r1=657275&r2=657276&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/test_spec.rb (original)
+++ incubator/buildr/trunk/spec/test_spec.rb Fri May 16 18:40:02 2008
@@ -374,11 +374,13 @@
it 'should inherit options from parent project' do
define 'foo' do
- test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }
+ test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
define 'bar' do
+ test.using :junit
test.options[:fail_on_failure].should be_false
test.options[:fork].should == :each
test.options[:properties][:foo].should == 'bar'
+ test.options[:environment]['config'].should == 'config.yaml'
end
end
end
@@ -386,11 +388,13 @@
it 'should clone options from parent project' do
define 'foo' do
define 'bar' do
- test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }
+ test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
+ test.using :junit
end.invoke
test.options[:fail_on_failure].should be_true
test.options[:fork].should == :once
- test.options[:other].should be_nil
+ test.options[:properties].should be_empty
+ test.options[:environment].should be_empty
end
end
end