diff options
Diffstat (limited to 'test/irb/test_cmd.rb')
-rw-r--r-- | test/irb/test_cmd.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 16f5940338..4a512ed1e6 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -374,5 +374,22 @@ module TestIRB /=> "bug17564"\n/, ], out) end + + def test_ls + IRB.init_config(nil) + workspace = IRB::WorkSpace.new(self) + irb = IRB::Irb.new(workspace) + IRB.conf[:MAIN_CONTEXT] = irb.context + input = TestInputMethod.new([ + "ls Object.new.tap { |o| o.instance_variable_set(:@a, 1) }\n", + ]) + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + irb.context.return_format = "=> %s\n" + out, err = capture_output do + irb.eval_input + end + assert_empty err + assert_match(/^instance variables: @a\n/, out) + end end end |