summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Reitmayr <treitmayr@devbase.at>2021-03-16 22:09:50 +0100
committerThomas Reitmayr <treitmayr@devbase.at>2021-03-16 22:09:50 +0100
commit505ffde65551997f5b6b2debfb434979a9603d66 (patch)
tree1a090f8d4e0f76503f264e8639a9f1fbcd34ee7f
parent7963445048faba81bd99ba9ef79807910b263c7d (diff)
downloadswig-505ffde65551997f5b6b2debfb434979a9603d66.tar.gz
Add justification for suppressing warnings in Ruby test case
In the same file removed a useless class for comparing versions.
-rw-r--r--Examples/test-suite/ruby/preproc_runme.rb21
1 files changed, 5 insertions, 16 deletions
diff --git a/Examples/test-suite/ruby/preproc_runme.rb b/Examples/test-suite/ruby/preproc_runme.rb
index 14c5c139f..4b4a9157d 100644
--- a/Examples/test-suite/ruby/preproc_runme.rb
+++ b/Examples/test-suite/ruby/preproc_runme.rb
@@ -5,23 +5,12 @@
require 'swig_assert'
-# helper class for comparing version strings
-class Version
- attr_reader :array
- def initialize(s)
- @array = s.split('.').map { |e| e.to_i }
- end
- def <(rhs)
- a = @array.clone
- b = rhs.array.clone
- a << 0 while a.size < b.size
- b << 0 while b.size < a.size
- (a <=> b) < 0
- end
-end
-
+# This extension to the Warning class is intended for suppressing expected
+# Ruby warning messages about invalid or redefined Ruby constants - basically
+# the equivalent of %warnfilter(SWIGWARN_RUBY_WRONG_NAME) but for the moment
+# the wrapper library is loaded by the Ruby interpreter.
+# Note: This only works for Ruby 2.4 and later
if Object.const_defined?(:Warning) && Warning.respond_to?(:warn)
- # suppressing warnings like this only works for Ruby 2.4 and later
module CustomWarningFilter
def warn(*args)
msg = args[0]