summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_init.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/irb/test_init.rb b/test/irb/test_init.rb
new file mode 100644
index 0000000000..f2022253f9
--- /dev/null
+++ b/test/irb/test_init.rb
@@ -0,0 +1,25 @@
+# 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: [])
+ assert_equal argv, ARGV
+ end
+ end
+
+ private
+
+ def with_argv(argv)
+ orig = ARGV.dup
+ ARGV.replace(argv)
+ yield
+ ensure
+ ARGV.replace(orig)
+ end
+ end
+end