diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-03-18 01:18:42 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-03-21 13:40:21 +0900 |
commit | 232433f22423fb6a3ff7a610140c711a964d3b3d (patch) | |
tree | fe319dccd48a1b0ea4dbfb0c1939ec37d6809492 /test | |
parent | 5f72962a0955d62dfbac2f7553b725b9d1e9e60d (diff) |
[ruby/irb] Add whereami command
https://github.com/ruby/irb/commit/bc822e4aac
Diffstat (limited to 'test')
-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 4a512ed1e6..778b3f863b 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -391,5 +391,22 @@ module TestIRB assert_empty err assert_match(/^instance variables: @a\n/, out) end + + def test_whereami + IRB.init_config(nil) + workspace = IRB::WorkSpace.new(self) + irb = IRB::Irb.new(workspace) + IRB.conf[:MAIN_CONTEXT] = irb.context + input = TestInputMethod.new([ + "whereami\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(/^From: .+ @ line \d+ :\n/, out) + end end end |