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

renamed inp and out special locals to _in_ and _out_ and updated tests

This commit is contained in:
John Mair 2011-09-01 16:58:38 +12:00
parent b3576244db
commit be77470bd9
2 changed files with 11 additions and 11 deletions

View file

@ -108,8 +108,8 @@ class Pry
# Make sure special locals exist at start of session # Make sure special locals exist at start of session
def initialize_special_locals(target) def initialize_special_locals(target)
inject_local("inp", @input_array, target) inject_local("_in_", @input_array, target)
inject_local("out", @output_array, target) inject_local("_out_", @output_array, target)
inject_local("_pry_", self, target) inject_local("_pry_", self, target)
inject_local("_ex_", nil, target) inject_local("_ex_", nil, target)
inject_local("_file_", nil, target) inject_local("_file_", nil, target)
@ -122,8 +122,8 @@ class Pry
private :initialize_special_locals private :initialize_special_locals
def inject_special_locals(target) def inject_special_locals(target)
inject_local("inp", @input_array, target) inject_local("_in_", @input_array, target)
inject_local("out", @output_array, target) inject_local("_out_", @output_array, target)
inject_local("_pry_", self, target) inject_local("_pry_", self, target)
inject_local("_ex_", self.last_exception, target) inject_local("_ex_", self.last_exception, target)
inject_local("_file_", self.last_file, target) inject_local("_file_", self.last_file, target)

View file

@ -204,7 +204,7 @@ describe Pry do
it 'sets out to an array with the result' do it 'sets out to an array with the result' do
res = {} res = {}
input = InputTester.new *[":foo", "42", "self[:res] = out"] input = InputTester.new *[":foo", "42", "self[:res] = _out_"]
pry = Pry.new(:input => input, :output => Pry::NullOutput) pry = Pry.new(:input => input, :output => Pry::NullOutput)
pry.repl(res) pry.repl(res)
@ -212,9 +212,9 @@ describe Pry do
res[:res][1..2].should == [:foo, 42] res[:res][1..2].should == [:foo, 42]
end end
it 'sets inp to an array with the entered lines' do it 'sets _in_ to an array with the entered lines' do
res = {} res = {}
input = InputTester.new *[":foo", "42", "self[:res] = inp"] input = InputTester.new *[":foo", "42", "self[:res] = _in_"]
pry = Pry.new(:input => input, :output => Pry::NullOutput) pry = Pry.new(:input => input, :output => Pry::NullOutput)
pry.repl(res) pry.repl(res)
@ -222,9 +222,9 @@ describe Pry do
res[:res][1..2].should == [":foo\n", "42\n"] res[:res][1..2].should == [":foo\n", "42\n"]
end end
it 'uses 100 as the size of inp and out' do it 'uses 100 as the size of _in_ and _out_' do
res = [] res = []
input = InputTester.new *["self << out.max_size << inp.max_size"] input = InputTester.new *["self << _out_.max_size << _in_.max_size"]
pry = Pry.new(:input => input, :output => Pry::NullOutput) pry = Pry.new(:input => input, :output => Pry::NullOutput)
pry.repl(res) pry.repl(res)
@ -233,7 +233,7 @@ describe Pry do
it 'can change the size of the history arrays' do it 'can change the size of the history arrays' do
res = [] res = []
input = InputTester.new *["self << out.max_size << inp.max_size"] input = InputTester.new *["self << _out_.max_size << _in_.max_size"]
pry = Pry.new(:input => input, :output => Pry::NullOutput, pry = Pry.new(:input => input, :output => Pry::NullOutput,
:memory_size => 1000) :memory_size => 1000)
pry.repl(res) pry.repl(res)
@ -243,7 +243,7 @@ describe Pry do
it 'store exceptions' do it 'store exceptions' do
res = [] res = []
input = InputTester.new *["foo!","self << inp[-1] << out[-1]"] input = InputTester.new *["foo!","self << _in_[-1] << _out_[-1]"]
pry = Pry.new(:input => input, :output => Pry::NullOutput, pry = Pry.new(:input => input, :output => Pry::NullOutput,
:memory_size => 1000) :memory_size => 1000)
pry.repl(res) pry.repl(res)