1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/irb/test_init.rb
kazu 38f137276d Suppress read of ~/.irbrc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-18 04:09:48 +00:00

31 lines
642 B
Ruby

# frozen_string_literal: false
require "test/unit"
require "irb"
module TestIRB
class TestInit < Test::Unit::TestCase
def test_setup_with_argv_preserves_global_argv
argv = ["foo", "bar"]
with_argv(argv) do
IRB.setup(eval("__FILE__"), argv: %w[-f])
assert_equal argv, ARGV
end
end
def test_setup_with_minimum_argv_does_not_change_dollar0
orig = $0.dup
IRB.setup(eval("__FILE__"), argv: %w[-f])
assert_equal orig, $0
end
private
def with_argv(argv)
orig = ARGV.dup
ARGV.replace(argv)
yield
ensure
ARGV.replace(orig)
end
end
end