1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Ensure running commands in multiline exprs works

This commit is contained in:
Conrad Irwin 2012-12-15 14:09:16 -08:00
parent 68bcca22a0
commit e020f8cecd
2 changed files with 16 additions and 1 deletions

View file

@ -308,7 +308,7 @@ class Pry
# Change the eval_string into the input encoding (Issue 284)
ensure_correct_encoding!(eval_string, val)
if !process_command_safely(val, eval_string, target)
if !process_command_safely(val.lstrip, eval_string, target)
eval_string << "#{val.chomp}\n" unless val.empty?
end
end

15
spec/pry_repl_spec.rb Normal file
View file

@ -0,0 +1,15 @@
require 'helper'
describe "The REPL" do
before do
Pry.config.auto_indent = true
end
after do
Pry.config.auto_indent = false
end
it "should let you run commands in the middle of multiline expressions" do
mock_pry("def a", "!", "5").should =~ /Input buffer cleared/
end
end