Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.5
-
Fix Version/s: JRuby 1.6.6, JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules
-
Labels:None
-
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]
-
Testcase included:yes
-
Number of attachments :
Description
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.
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
Courtesy of berger_spec. ![]()
Activity
Hiro Asari
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Hiro Asari [ asari ] |
Hiro Asari
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | JRuby 1.6.6 [ 18033 ] | |
| Fix Version/s | JRuby 1.7 [ 17049 ] | |
| Resolution | Fixed [ 1 ] |
Charles Oliver Nutter
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |