mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
added yet more tests for amend-line, this time for insert behaviour
This commit is contained in:
parent
a1c85e1561
commit
52611848d8
1 changed files with 20 additions and 4 deletions
|
@ -73,7 +73,7 @@ describe "Pry::DefaultCommands::Input" do
|
|||
pry
|
||||
end
|
||||
|
||||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bing\n\d+: puts :boast\n\d+: puts :heart/
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :bing\n\d+: puts :boast\n\d+: puts :heart/
|
||||
end
|
||||
|
||||
it 'should correctly delete a range of lines using the ! for content' do
|
||||
|
@ -82,7 +82,7 @@ describe "Pry::DefaultCommands::Input" do
|
|||
pry
|
||||
end
|
||||
|
||||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :heart\n\Z/
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :heart\n\Z/
|
||||
end
|
||||
|
||||
it 'should correctly delete the previous line using the ! for content' do
|
||||
|
@ -91,7 +91,7 @@ describe "Pry::DefaultCommands::Input" do
|
|||
pry
|
||||
end
|
||||
|
||||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bing\n\d+: puts :bang\n\d+: puts :boast\n\Z/
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :bing\n\d+: puts :bang\n\d+: puts :boast\n\Z/
|
||||
end
|
||||
|
||||
it 'should correctly amend the specified range of lines, using negative numbers in range' do
|
||||
|
@ -99,7 +99,23 @@ describe "Pry::DefaultCommands::Input" do
|
|||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :boast", "puts :heart", "amend-line-1..-2 puts :bong", "show-input", "exit-all"), str_output) do
|
||||
pry
|
||||
end
|
||||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bong\n\d+: puts :heart/
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :bong\n\d+: puts :heart/
|
||||
end
|
||||
|
||||
it 'should correctly insert a new line of input before a specified line using the > syntax' do
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "amend-line 1 >puts :inserted", "show-input", "exit-all"), str_output) do
|
||||
pry
|
||||
end
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :inserted\n\d+: puts :bing\n\d+: puts :bang/
|
||||
end
|
||||
|
||||
it 'should correctly insert a new line of input before a specified line using the > syntax (should ignore second value of range)' do
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "amend-line 1..20 >puts :inserted", "show-input", "exit-all"), str_output) do
|
||||
pry
|
||||
end
|
||||
str_output.string.should =~ /\d+: def hello\n\d+: puts :inserted\n\d+: puts :bing\n\d+: puts :bang/
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue