diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-07-27 21:41:08 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-07-27 21:41:08 +0200 |
commit | 126fd5f15cff0d3bf314d90d8c21a3ae25ae8e68 (patch) | |
tree | 33350f7170436c32ed4c8e79f0be2c334c7bc8a9 /spec/ruby/core/kernel/__dir___spec.rb | |
parent | 7429841ab6494b849106e6d3b119f147adfee3b7 (diff) |
Update to ruby/spec@07164da
Diffstat (limited to 'spec/ruby/core/kernel/__dir___spec.rb')
-rw-r--r-- | spec/ruby/core/kernel/__dir___spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/__dir___spec.rb b/spec/ruby/core/kernel/__dir___spec.rb index 64b439161f..0686b31e97 100644 --- a/spec/ruby/core/kernel/__dir___spec.rb +++ b/spec/ruby/core/kernel/__dir___spec.rb @@ -5,6 +5,13 @@ describe "Kernel#__dir__" do __dir__.should == File.realpath(File.dirname(__FILE__)) end + it "returns the expanded path of the directory when used in the main script" do + fixtures_dir = File.dirname(fixture(__FILE__, '__dir__.rb')) + Dir.chdir(fixtures_dir) do + ruby_exe("__dir__.rb").should == "__dir__.rb\n#{fixtures_dir}\n" + end + end + context "when used in eval with a given filename" do it "returns File.dirname(filename)" do eval("__dir__", nil, "foo.rb").should == "." |