mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix indentation (HARDER)
This commit is contained in:
parent
4044682704
commit
d29f6b5c04
2 changed files with 37 additions and 37 deletions
|
@ -39,10 +39,10 @@ class Pry
|
||||||
Pry.config.editor.call(*args)
|
Pry.config.editor.call(*args)
|
||||||
else
|
else
|
||||||
sanitized_file = if windows?
|
sanitized_file = if windows?
|
||||||
file.gsub(/\//, '\\')
|
file.gsub(/\//, '\\')
|
||||||
else
|
else
|
||||||
Shellwords.escape(file)
|
Shellwords.escape(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
"#{Pry.config.editor} #{blocking_flag_for_editor(blocking)} #{start_line_syntax_for_editor(sanitized_file, line)}"
|
"#{Pry.config.editor} #{blocking_flag_for_editor(blocking)} #{start_line_syntax_for_editor(sanitized_file, line)}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
describe Pry::Editor do
|
describe Pry::Editor do
|
||||||
describe "build_editor_invocation_string" do
|
describe "build_editor_invocation_string" do
|
||||||
before do
|
before do
|
||||||
class << Pry::Editor
|
class << Pry::Editor
|
||||||
public :build_editor_invocation_string
|
public :build_editor_invocation_string
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'should shell-escape files' do
|
it 'should shell-escape files' do
|
||||||
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(/tmp/hello\\ world.rb)
|
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(/tmp/hello\\ world.rb)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "build_editor_invocation_string on windows" do
|
describe "build_editor_invocation_string on windows" do
|
||||||
before do
|
before do
|
||||||
class << Pry::Editor
|
class << Pry::Editor
|
||||||
def windows?; true; end
|
def windows?; true; end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
class << Pry::Editor
|
class << Pry::Editor
|
||||||
undef windows?
|
undef windows?
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "should replace / by \\" do
|
it "should replace / by \\" do
|
||||||
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(\\tmp\\)
|
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(\\tmp\\)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not shell-escape files" do
|
it "should not shell-escape files" do
|
||||||
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(hello world.rb)
|
Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(hello world.rb)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'invoke_editor with a proc' do
|
describe 'invoke_editor with a proc' do
|
||||||
before do
|
before do
|
||||||
@old_editor = Pry.config.editor
|
@old_editor = Pry.config.editor
|
||||||
Pry.config.editor = proc{ |file, line, blocking|
|
Pry.config.editor = proc{ |file, line, blocking|
|
||||||
@file = file
|
@file = file
|
||||||
nil
|
nil
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Pry.config.editor = @old_editor
|
Pry.config.editor = @old_editor
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not shell-escape files' do
|
it 'should not shell-escape files' do
|
||||||
Pry::Editor.invoke_editor('/tmp/hello world.rb', 10, true)
|
Pry::Editor.invoke_editor('/tmp/hello world.rb', 10, true)
|
||||||
@file.should == "/tmp/hello world.rb"
|
@file.should == "/tmp/hello world.rb"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue