Daniel Berger created JRUBY-6295:
------------------------------------

             Summary: Dir.chdir, $HOME and $LOGDIR behavior
                 Key: JRUBY-6295
                 URL: https://jira.codehaus.org/browse/JRUBY-6295
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.6.5
         Environment: jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java 
HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
            Reporter: Daniel Berger
            Priority: Minor


This is a followup to jruby-673. In MRI, Dir.chdir defaults to $HOME if no 
directory is specified. That was fixed. However, if $HOME is not set, it should 
default to $LOGDIR. If neither $HOME nor $LOGDIR are set, it should raise an 
error with a specific error message. Take a look at dir_s_chdir in dir.c for 
more information.
{noformat}
test "chdir without an argument defaults to LOGDIR if HOME is not set" do
  ENV['HOME']   = nil
  ENV['LOGDIR'] = Dir.pwd
  Dir.chdir
  assert_equal(ENV['LOGDIR'], Dir.pwd)
end

test "chdir raises an error if both the HOME and LOGDIR env variables are nil" 
do
  ENV['HOME'] = nil
  ENV['LOGDIR'] = nil
  assert_raise(ArgumentError){ Dir.chdir }
  assert_raise_message("HOME/LOGDIR not set"){ Dir.chdir }
end
{noformat}
Courtesy of berger_spec. :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to