From e39b2cff8ac2dc93b35bd43ffcce3ded8e3b4c25 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Jul 2018 05:05:27 +0000 Subject: [PATCH] ruby.c: disable DidYouMean as gem * ruby.c (process_options): as DidYouMean requires Rubygems, disable the former when the latter is disabled too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 6 +++--- test/ruby/test_rubyoptions.rb | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ruby.c b/ruby.c index a34b956184..8a225869a5 100644 --- a/ruby.c +++ b/ruby.c @@ -1690,9 +1690,9 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) Init_ext(); /* load statically linked extensions before rubygems */ if (opt->features & FEATURE_BIT(gems)) { rb_define_module("Gem"); - } - if (opt->features & FEATURE_BIT(did_you_mean)) { - rb_define_module("DidYouMean"); + if (opt->features & FEATURE_BIT(did_you_mean)) { + rb_define_module("DidYouMean"); + } } ruby_init_prelude(); if ((opt->features ^ DEFAULT_FEATURES) & COMPILATION_FEATURES) { diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index edd44ca0ae..65dc2267cb 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -151,6 +151,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/) assert_in_out_err(%w(--disable-gems -e) + ['p defined? Gem'], "", ["nil"], []) assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], []) + assert_in_out_err(%w(--disable-gems -e) + ['p defined? DidYouMean'], "", ["nil"], []) end def test_kanji