ruby-changes:22336
From: nobu <ko1@a...>
Date: Sat, 28 Jan 2012 05:53:58 +0900 (JST)
Subject: [ruby-changes:22336] nobu:r34384 (trunk, ruby_1_9_3): * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
nobu 2012-01-28 05:53:37 +0900 (Sat, 28 Jan 2012) New Revision: 34384 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34384 Log: * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc): ignore non-string name modules. [ruby-core:42244][Bug #5938] Added files: branches/ruby_1_9_3/test/irb/test_completion.rb trunk/test/irb/test_completion.rb Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/lib/irb/completion.rb trunk/ChangeLog trunk/lib/irb/completion.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34383) +++ ChangeLog (revision 34384) @@ -1,3 +1,8 @@ +Sat Jan 28 05:53:34 2012 Nobuyoshi Nakada <nobu@r...> + + * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc): + ignore non-string name modules. [ruby-core:42244][Bug #5938] + Fri Jan 27 16:31:45 2012 Nobuyoshi Nakada <nobu@r...> * gc.c (HEAP_ALIGN, HEAP_ALIGN_MASK): DRY, let compiler calculate Index: lib/irb/completion.rb =================================================================== --- lib/irb/completion.rb (revision 34383) +++ lib/irb/completion.rb (revision 34384) @@ -178,8 +178,12 @@ rescue Exception name = "" end - next if name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ name + begin + next if name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ name + rescue Exception + next + end candidates.concat m.instance_methods(false).collect{|x| x.to_s} } candidates.sort! Index: test/irb/test_completion.rb =================================================================== --- test/irb/test_completion.rb (revision 0) +++ test/irb/test_completion.rb (revision 34384) @@ -0,0 +1,17 @@ +require 'test/unit' +require_relative '../ruby/envutil' + +module TestIRB + class TestCompletion < Test::Unit::TestCase + def test_nonstring_module_name + bug5938 = '[ruby-core:42244]' + cmds = %W[-rirb -rirb/completion -e IRB.setup(__FILE__) + -e IRB.conf[:MAIN_CONTEXT]=IRB::Irb.new.context + -e module\sFoo;def\sself.name;//;end;end + -e IRB::InputCompletor::CompletionProc.call("[1].first.") + -- -f --] + status = assert_in_out_err(cmds, "", //, [], bug5938) + assert(status.success?, bug5938) + end + end +end Property changes on: test/irb/test_completion.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 34383) +++ ruby_1_9_3/ChangeLog (revision 34384) @@ -1,3 +1,8 @@ +Sat Jan 28 05:53:34 2012 Nobuyoshi Nakada <nobu@r...> + + * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc): + ignore non-string name modules. [ruby-core:42244][Bug #5938] + Mon Jan 23 18:18:58 2012 NARUSE, Yui <naruse@r...> * encoding.c (rb_enc_compatible): fix segv on symbols. Index: ruby_1_9_3/lib/irb/completion.rb =================================================================== --- ruby_1_9_3/lib/irb/completion.rb (revision 34383) +++ ruby_1_9_3/lib/irb/completion.rb (revision 34384) @@ -178,8 +178,12 @@ rescue Exception name = "" end - next if name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ name + begin + next if name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ name + rescue Exception + next + end candidates.concat m.instance_methods(false).collect{|x| x.to_s} } candidates.sort! Index: ruby_1_9_3/test/irb/test_completion.rb =================================================================== --- ruby_1_9_3/test/irb/test_completion.rb (revision 0) +++ ruby_1_9_3/test/irb/test_completion.rb (revision 34384) @@ -0,0 +1,17 @@ +require 'test/unit' +require_relative '../ruby/envutil' + +module TestIRB + class TestCompletion < Test::Unit::TestCase + def test_nonstring_module_name + bug5938 = '[ruby-core:42244]' + cmds = %W[-rirb -rirb/completion -e IRB.setup(__FILE__) + -e IRB.conf[:MAIN_CONTEXT]=IRB::Irb.new.context + -e module\sFoo;def\sself.name;//;end;end + -e IRB::InputCompletor::CompletionProc.call("[1].first.") + -- -f --] + status = assert_in_out_err(cmds, "", //, [], bug5938) + assert(status.success?, bug5938) + end + end +end Property changes on: ruby_1_9_3/test/irb/test_completion.rb ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/