ruby-changes:50998
From: nobu <ko1@a...>
Date: Fri, 20 Apr 2018 08:35:44 +0900 (JST)
Subject: [ruby-changes:50998] nobu:r63205 (trunk): fiddle/import.rb: suppress warning
nobu 2018-04-20 08:35:39 +0900 (Fri, 20 Apr 2018) New Revision: 63205 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63205 Log: fiddle/import.rb: suppress warning * ext/fiddle/lib/fiddle/import.rb: suppress exception report when $DEBUG is enabled. [ruby-core:86536] [Bug #14686] Modified files: trunk/ext/fiddle/lib/fiddle/import.rb trunk/test/fiddle/test_import.rb Index: ext/fiddle/lib/fiddle/import.rb =================================================================== --- ext/fiddle/lib/fiddle/import.rb (revision 63204) +++ ext/fiddle/lib/fiddle/import.rb (revision 63205) @@ -157,7 +157,8 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/ext/fiddle/lib/fiddle/import.rb#L157 # :stopdoc: CALL_TYPE_TO_ABI = Hash.new { |h, k| raise RuntimeError, "unsupported call type: #{k}" - }.merge({ :stdcall => (Function::STDCALL rescue Function::DEFAULT), + }.merge({ :stdcall => Function.const_defined?(:STDCALL) ? Function::STDCALL : + Function::DEFAULT, :cdecl => Function::DEFAULT, nil => Function::DEFAULT }).freeze Index: test/fiddle/test_import.rb =================================================================== --- test/fiddle/test_import.rb (revision 63204) +++ test/fiddle/test_import.rb (revision 63205) @@ -147,5 +147,9 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_import.rb#L147 r = LIBC.atof("12.34") assert_includes(12.00..13.00, r) end + + def test_no_message_with_debug + assert_in_out_err(%w[--debug -rfiddle/import], 'p Fiddle::Importer', ['Fiddle::Importer']) + end end end if defined?(Fiddle) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/