From 89c7e6de442d558b6819cb23b7a011410ea19668 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Tue, 12 Dec 2017 13:56:48 +0000 Subject: [PATCH] irb/test_init.rb: add test to ensure $0 is not changed. At first `ARGV.unshift('something')` was suggested for r61149, but it wasn't sufficient because it modifies $0. Not only to preserve ARGV, but also r61149 intends to preserve $0. This test prevents future breakage of the behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/irb/test_init.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/irb/test_init.rb b/test/irb/test_init.rb index f2022253f9..3d6c0f3bdc 100644 --- a/test/irb/test_init.rb +++ b/test/irb/test_init.rb @@ -12,6 +12,12 @@ module TestIRB end end + def test_setup_with_empty_argv_does_not_change_dollar0 + orig = $0.dup + IRB.setup(eval("__FILE__"), argv: []) + assert_equal orig, $0 + end + private def with_argv(argv)