From e87fb88be844f0fae736768846954b6f6f7dc7c3 Mon Sep 17 00:00:00 2001 From: eregon Date: Tue, 25 Sep 2018 10:41:16 +0000 Subject: Update to ruby/spec@241f9e7 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- .../ruby/core/thread/backtrace/location/absolute_path_spec.rb | 11 +++++++++++ .../backtrace/location/fixtures/absolute_path_method_added.rb | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb (limited to 'spec/ruby/core/thread') diff --git a/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb b/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb index 5bd97442d9..d38659c257 100644 --- a/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb +++ b/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb @@ -18,6 +18,17 @@ describe 'Thread::Backtrace::Location#absolute_path' do end end + context "when used in #method_added" do + it "returns the user filename that defined the method" do + path = fixture(__FILE__, "absolute_path_method_added.rb") + load path + locations = ScratchPad.recorded + locations[0].absolute_path.should == path + # Make sure it's from the class body, not from the file top-level + locations[0].label.should include 'MethodAddedAbsolutePath' + end + end + platform_is_not :windows do before :each do @file = fixture(__FILE__, "absolute_path.rb") diff --git a/spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb b/spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb new file mode 100644 index 0000000000..26d6298a19 --- /dev/null +++ b/spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb @@ -0,0 +1,10 @@ +module ThreadBacktraceLocationSpecs + class MethodAddedAbsolutePath + def self.method_added(name) + ScratchPad.record caller_locations + end + + def foo + end + end +end -- cgit v1.2.3