diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-19 23:35:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-19 23:35:39 +0000 |
commit | eb02a846a446e87df079956354387d4a83704d50 (patch) | |
tree | e3d807a5a04f38643a0dd41509cdb1c1875ee16a | |
parent | 9090241e614d3c5b302b713041164e27929f8898 (diff) | |
download | ruby-eb02a846a446e87df079956354387d4a83704d50.tar.gz |
fiddle/import.rb: suppress warning
* ext/fiddle/lib/fiddle/import.rb: suppress exception report when
$DEBUG is enabled. [ruby-core:86536] [Bug #14686]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/fiddle/lib/fiddle/import.rb | 3 | ||||
-rw-r--r-- | test/fiddle/test_import.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb index ae44914ec3..178ebb8c76 100644 --- a/ext/fiddle/lib/fiddle/import.rb +++ b/ext/fiddle/lib/fiddle/import.rb @@ -157,7 +157,8 @@ module Fiddle # :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 diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb index e08853da14..387f58295e 100644 --- a/test/fiddle/test_import.rb +++ b/test/fiddle/test_import.rb @@ -147,5 +147,9 @@ module Fiddle 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) |