added more tests for amend-line relating to deletion of lines using bang, also testing error messages when nothing to amend
This commit is contained in:
parent
94bdec56f0
commit
6b1b680c06
|
@ -28,6 +28,15 @@ describe "Pry::DefaultCommands::Input" do
|
|||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bing\n\d+: puts \"\#{goodbye}\"/
|
||||
end
|
||||
|
||||
it 'should display error if nothing to amend' do
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("amend-line", "exit-all"), str_output) do
|
||||
pry
|
||||
end
|
||||
str_output.string.should =~ /No input to amend/
|
||||
end
|
||||
|
||||
|
||||
it 'should correctly amend the specified range of lines' do
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :heart", "amend-line-1..2 puts :bong", "show-input", "exit-all"), str_output) do
|
||||
|
@ -45,6 +54,24 @@ describe "Pry::DefaultCommands::Input" do
|
|||
str_output.string.should =~ /\A\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
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :boast", "puts :heart", "amend-line 1..3 !", "show-input", "exit-all"), str_output) do
|
||||
pry
|
||||
end
|
||||
|
||||
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :heart\n\Z/
|
||||
end
|
||||
|
||||
it 'should correctly delete the previous line using the ! for content' do
|
||||
str_output = StringIO.new
|
||||
redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :boast", "puts :heart", "amend-line !", "show-input", "exit-all"), str_output) 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/
|
||||
end
|
||||
|
||||
it 'should correctly amend the specified range of lines, using negative numbers in range' do
|
||||
str_output = StringIO.new
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue