mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Don't use shellwords for find-method [Fixes #652]
This commit is contained in:
parent
d718c236f6
commit
dac6c71cda
2 changed files with 15 additions and 1 deletions
|
@ -8,6 +8,7 @@ class Pry
|
|||
group "Context"
|
||||
|
||||
options :requires_gem => "ruby18_source_location" if mri_18?
|
||||
options :shellwords => false
|
||||
|
||||
description "Recursively search for a method within a Class/Module or the current namespace. find-method [-n | -c] METHOD [NAMESPACE]"
|
||||
|
||||
|
|
|
@ -13,9 +13,15 @@ unless Pry::Helpers::BaseHelpers.mri_18?
|
|||
def goodbye
|
||||
"jenny"
|
||||
end
|
||||
def tea_tim?
|
||||
"timothy"
|
||||
end
|
||||
def tea_time?
|
||||
"polly"
|
||||
end
|
||||
end
|
||||
|
||||
describe "find-command" do
|
||||
describe "find-method" 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
|
||||
|
@ -44,6 +50,13 @@ unless Pry::Helpers::BaseHelpers.mri_18?
|
|||
|
||||
mock_pry("find-method -c timothy MyKlass").should =~ /MyKlass.*?hello/m
|
||||
end
|
||||
|
||||
it "should escape regexes correctly" do
|
||||
mock_pry('find-method tea_time? MyKlass').should =~ /tea_tim\?/
|
||||
mock_pry('find-method tea_time? MyKlass').should =~ /tea_time\?/
|
||||
mock_pry('find-method tea_time\? MyKlass').should.not =~ /tea_tim\?/
|
||||
mock_pry('find-method tea_time\? MyKlass').should =~ /tea_time\?/
|
||||
end
|
||||
end
|
||||
|
||||
Object.remove_const(:MyKlass)
|
||||
|
|
Loading…
Reference in a new issue