diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-25 10:41:16 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-25 10:41:16 +0000 |
commit | e87fb88be844f0fae736768846954b6f6f7dc7c3 (patch) | |
tree | cbe2ab069e40b5b7f3217ce95b793426b303a305 /spec/ruby/core/thread | |
parent | e59bf54b3a88d0465cca021afae7dc05b6db57a7 (diff) | |
download | ruby-e87fb88be844f0fae736768846954b6f6f7dc7c3.tar.gz |
Update to ruby/spec@241f9e7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/thread')
-rw-r--r-- | spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb | 11 | ||||
-rw-r--r-- | spec/ruby/core/thread/backtrace/location/fixtures/absolute_path_method_added.rb | 10 |
2 files changed, 21 insertions, 0 deletions
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 |