mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Revert "prevent find_method test running on MRI 1.8"
This reverts commit 88580c0731
.
This commit is contained in:
parent
49ed4815c6
commit
c2f06f3da2
1 changed files with 30 additions and 37 deletions
|
@ -1,42 +1,35 @@
|
|||
require 'helper'
|
||||
|
||||
# we turn off the test for MRI 1.8 because our source_location hack
|
||||
# for C methods actually runs the methods - and since it runs ALL
|
||||
# methods (in an attempt to find a match) it runs 'exit' and aborts
|
||||
# the test, causing a failure. We should fix this in the future by
|
||||
# blacklisting certain methods for 1.8 MRI (such as exit, fork, and so on)
|
||||
if !(RUBY_VERSION["1.8"] && !defined?(RUBY_ENGINE))
|
||||
MyKlass = Class.new do
|
||||
def hello
|
||||
"timothy"
|
||||
end
|
||||
def goodbye
|
||||
"jenny"
|
||||
end
|
||||
MyKlass = Class.new do
|
||||
def hello
|
||||
"timothy"
|
||||
end
|
||||
|
||||
describe "find-command" do
|
||||
describe "find matching methods by name regex (-n option)" do
|
||||
it "should find a method by regex" do
|
||||
mock_pry("find-method hell MyKlass").should =~ /MyKlass.*?hello/m
|
||||
end
|
||||
|
||||
it "should NOT match a method that does not match the regex" do
|
||||
mock_pry("find-method hell MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
||||
end
|
||||
end
|
||||
|
||||
describe "find matching methods by content regex (-c option)" do
|
||||
it "should find a method by regex" do
|
||||
mock_pry("find-method -c timothy MyKlass").should =~ /MyKlass.*?hello/m
|
||||
end
|
||||
|
||||
it "should NOT match a method that does not match the regex" do
|
||||
mock_pry("find-method timothy MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
||||
end
|
||||
end
|
||||
|
||||
def goodbye
|
||||
"jenny"
|
||||
end
|
||||
|
||||
Object.remove_const(:MyKlass)
|
||||
end
|
||||
|
||||
describe "find-command" do
|
||||
describe "find matching methods by name regex (-n option)" do
|
||||
it "should find a method by regex" do
|
||||
mock_pry("find-method hell MyKlass").should =~ /MyKlass.*?hello/m
|
||||
end
|
||||
|
||||
it "should NOT match a method that does not match the regex" do
|
||||
mock_pry("find-method hell MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
||||
end
|
||||
end
|
||||
|
||||
describe "find matching methods by content regex (-c option)" do
|
||||
it "should find a method by regex" do
|
||||
mock_pry("find-method -c timothy MyKlass").should =~ /MyKlass.*?hello/m
|
||||
end
|
||||
|
||||
it "should NOT match a method that does not match the regex" do
|
||||
mock_pry("find-method timothy MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Object.remove_const(:MyKlass)
|
||||
|
|
Loading…
Add table
Reference in a new issue