diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-03-31 22:49:51 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-04-02 16:40:06 +0900 |
commit | 9e336f73fb7d37f3b09e360f8204828bbca51cd5 (patch) | |
tree | 3327a48e892556036bc6d11f43cbfe9c376b25a9 /test/irb | |
parent | 43e0677c6de891c184da4ec66a03005d0824d5d0 (diff) |
[ruby/irb] Add show_source command
https://github.com/ruby/irb/commit/108cb04352
Diffstat (limited to 'test/irb')
-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 8f46a27927..044d852a32 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -392,6 +392,23 @@ module TestIRB assert_match(/^instance variables:\s+@a\n/m, out) end + def test_show_source + input = TestInputMethod.new([ + "show_source 'IRB.conf'\n", + ]) + IRB.init_config(nil) + workspace = IRB::WorkSpace.new(self) + irb = IRB::Irb.new(workspace, input) + IRB.conf[:VERBOSE] = false + IRB.conf[:MAIN_CONTEXT] = irb.context + irb.context.return_format = "=> %s\n" + out, err = capture_output do + irb.eval_input + end + assert_empty err + assert_match(%r[/irb\.rb], out) + end + def test_whereami input = TestInputMethod.new([ "whereami\n", |