summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-08-13 01:00:16 +0900
committerNobuyoshi Nakada <[email protected]>2023-08-13 02:26:49 +0900
commitb56e5c6b9425a19c04d4e59410463155ea9db30c (patch)
treeb7f39cb10c560fa5d0cf39519969a2b262f60c15 /test/ruby/test_rubyoptions.rb
parent546c5cfe4ce1335cb45f8e7b6d6da317c61509e7 (diff)
Fix the precedence of `--backtrace-limit` option
In general, if the same option specifying a single value is given multiple times at the same level, the last one overrides the earlier ones, unless prohibited.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8212
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 7510505062..3d98cd6f4e 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -89,6 +89,10 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err([env], "p Thread::Backtrace.limit", ['5'], [])
assert_in_out_err([env, "--backtrace-limit=1"], "p Thread::Backtrace.limit", ['1'], [])
assert_in_out_err([env, "--backtrace-limit=-1"], "p Thread::Backtrace.limit", ['-1'], [])
+ assert_in_out_err([env, "--backtrace-limit=3", "--backtrace-limit=1"],
+ "p Thread::Backtrace.limit", ['1'], [])
+ assert_in_out_err([{"RUBYOPT" => "--backtrace-limit=5 --backtrace-limit=3"}],
+ "p Thread::Backtrace.limit", ['3'], [])
long_max = RbConfig::LIMITS["LONG_MAX"]
assert_in_out_err(%W(--backtrace-limit=#{long_max}), "p Thread::Backtrace.limit",
["#{long_max}"], [])