summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-03-18 00:28:04 -0700
committergit <svn-admin@ruby-lang.org>2021-03-21 12:59:51 +0900
commit5f72962a0955d62dfbac2f7553b725b9d1e9e60d (patch)
treed73f865d0ec71e2038463e4e6d19e814f8789f22 /test
parentd36ac283d188ba6d923c905a85341761fa1305c3 (diff)
[ruby/irb] Implement ls command
https://github.com/ruby/irb/commit/19b6c20604
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_cmd.rb17
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