public
Rubygem
Description: Apache Buildr
Homepage: http://incubator.apache.org/buildr
Clone URL: git://github.com/vic/buildr.git
Search Repo:
JUnit not passing environment variables from the :environment option.


git-svn-id: https://svn.apache.org/repos/asf/incubator/buildr/trunk@657276 
13f79535-47bb-0310-9956-ffa450edef68
Assaf (author)
Fri May 16 18:40:02 -0700 2008
commit  348397568c2a7affd285c14ae8c80ad232fce1c0
tree    7fa305623a9d6892475ec2074e5966831f899943
parent  acc42de84ddafeba6265d928ac63fb0b00ff2a12
...
5
6
7
 
 
8
9
10
...
5
6
7
8
9
10
11
12
0
@@ -5,6 +5,8 @@
0
 * Fixed: BUILDR-68 Now accepting JAVA_HOME setting on OS X (Nathan Hamblen).
0
 * Fixed: JUnit now accepts java_args and passes these arguments to the JVM
0
 (only applicable when forking).
0
+* Fixed: BUILDR-70 JUnit not passing environment variables fro the
0
+:environment option.
0
 
0
 1.3.0 (2008-04-25)
0
 * Added: Testing with EasyB (Nicolas Modrzyk).
...
200
201
202
203
 
204
205
206
...
200
201
202
 
203
204
205
206
0
@@ -200,7 +200,7 @@
0
         ant.junit forking.merge(:clonevm=>options[:clonevm] || false, :dir=>task.send(:project).path_to) do
0
           ant.classpath :path=>dependencies.join(File::PATH_SEPARATOR)
0
           (options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
0
- (options[:properties] || []).each { |key, value| ant.sysproperty :key=>key, :value=>value }
0
+ (options[:environment] || []).each { |key, value| ant.env :key=>key, :value=>value }
0
           Array(options[:java_args]).each { |value| ant.jvmarg :value=>value }
0
           ant.formatter :type=>'plain'
0
           ant.formatter :type=>'plain', :usefile=>false # log test
...
179
180
181
 
 
 
 
 
 
 
 
 
 
 
 
182
183
184
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
0
@@ -179,6 +179,18 @@
0
     project('foo').test.invoke
0
   end
0
 
0
+ it 'should pass environment to JVM' do
0
+ write 'src/test/java/EnvironmentTest.java', <<-JAVA
0
+ public class EnvironmentTest extends junit.framework.TestCase {
0
+ public void testEnvironment() {
0
+ assertEquals("value", System.getenv("NAME"));
0
+ }
0
+ }
0
+ JAVA
0
+ define('foo').test.using :environment=>{ 'NAME'=>'value' }
0
+ project('foo').test.invoke
0
+ end
0
+
0
   it 'should set current directory' do
0
     mkpath 'baz'
0
     expected = File.expand_path('baz')
...
374
375
376
377
 
378
 
379
380
381
 
382
383
384
385
...
386
387
388
389
 
 
390
391
392
393
 
 
394
395
396
...
374
375
376
 
377
378
379
380
381
382
383
384
385
386
387
...
388
389
390
 
391
392
393
394
395
 
396
397
398
399
400
0
@@ -374,11 +374,13 @@
0
 
0
   it 'should inherit options from parent project' do
0
     define 'foo' do
0
- test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }' }
0
+ test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
0
       define 'bar' do
0
+ test.using :junit
0
         test.options[:fail_on_failure].should be_false
0
         test.options[:fork].should == :each
0
         test.options[:properties][:foo].should == 'bar'
0
+ test.options[:environment]['config'].should == 'config.yaml'
0
       end
0
     end
0
   end
0
0
@@ -386,11 +388,13 @@
0
   it 'should clone options from parent project' do
0
     define 'foo' do
0
       define 'bar' do
0
- test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }
0
+ test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
0
+ test.using :junit
0
       end.invoke
0
       test.options[:fail_on_failure].should be_true
0
       test.options[:fork].should == :once
0
- test.options[:other].should be_nil
0
+ test.options[:properties].should be_empty
0
+ test.options[:environment].should be_empty
0
     end
0
   end
0
 end

Comments

    No one has commented yet.