ruby-changes:59350
From: Nobuyoshi <ko1@a...>
Date: Sat, 21 Dec 2019 01:02:47 +0900 (JST)
Subject: [ruby-changes:59350] 484c1be895 (master): Added `-W:experimental` command line option
https://git.ruby-lang.org/ruby.git/commit/?id=484c1be895 From 484c1be8956b7bb7a0253c6d6c7a740c341487fa Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 20 Dec 2019 23:51:17 +0900 Subject: Added `-W:experimental` command line option [Feature #16420] diff --git a/ruby.c b/ruby.c index f6785e4..e0ef3e9 100644 --- a/ruby.c +++ b/ruby.c @@ -1078,6 +1078,9 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1078 if (NAME_MATCH_P("deprecated", s, len)) { bits = 1U << RB_WARN_CATEGORY_DEPRECATED; } + else if (NAME_MATCH_P("experimental", s, len)) { + bits = 1U << RB_WARN_CATEGORY_EXPERIMENTAL; + } else { rb_warn("unknown warning category: `%s'", s); } diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 04a7016..cac4204 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -77,6 +77,8 @@ class TestRubyOptions < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L77 assert_in_out_err(%w(-w -W0 -e) + ['p $-W'], "", %w(0), []) assert_in_out_err(%w(-W:deprecated -e) + ['p Warning[:deprecated]'], "", %w(true), []) assert_in_out_err(%w(-W:no-deprecated -e) + ['p Warning[:deprecated]'], "", %w(false), []) + assert_in_out_err(%w(-W:experimental -e) + ['p Warning[:experimental]'], "", %w(true), []) + assert_in_out_err(%w(-W:no-experimental -e) + ['p Warning[:experimental]'], "", %w(false), []) assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: `qux'/) ensure ENV['RUBYOPT'] = save_rubyopt @@ -335,6 +337,10 @@ class TestRubyOptions < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L337 assert_in_out_err(%w(), "p Warning[:deprecated]", ["true"]) ENV['RUBYOPT'] = '-W:no-deprecated' assert_in_out_err(%w(), "p Warning[:deprecated]", ["false"]) + ENV['RUBYOPT'] = '-W:experimental' + assert_in_out_err(%w(), "p Warning[:experimental]", ["true"]) + ENV['RUBYOPT'] = '-W:no-experimental' + assert_in_out_err(%w(), "p Warning[:experimental]", ["false"]) ENV['RUBYOPT'] = '-W:qux' assert_in_out_err(%w(), "", [], /unknown warning category: `qux'/) ensure -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/