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

added tests for show-input and \! commands

This commit is contained in:
John Mair 2011-06-03 21:55:23 +12:00
parent cef1d2f6c6
commit 9a245adb04

View file

@ -20,6 +20,28 @@ describe "Pry::DefaultCommands::Input" do
end end
end end
describe "show-input" do
it 'should correctly show the current lines in the input buffer' do
str_output = StringIO.new
redirect_pry_io(InputTester.new("def hello", "puts :bing", "show-input", "exit-all"), str_output) do
pry
end
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bing/
end
end
describe "!" do
it 'should correctly clear the input buffer ' do
str_output = StringIO.new
redirect_pry_io(InputTester.new("def hello", "puts :bing", "!", "show-input", "exit-all"), str_output) do
pry
end
stripped_output = str_output.string.strip!
stripped_output.each_line.count.should == 1
stripped_output.should =~ /Input buffer cleared!/
end
end
describe "hist" do describe "hist" do
push_first_hist_line = lambda do |hist, line| push_first_hist_line = lambda do |hist, line|
hist.push line hist.push line