From f4e2a4feee287767481e8db912657cfc374acee8 Mon Sep 17 00:00:00 2001 From: Seth R Johnson Date: Sat, 26 Feb 2022 19:48:54 -0500 Subject: [PATCH] Fix warning and improve description of ignore_parameter test See https://github.com/swig/swig/pull/2205#issuecomment-1052648190 --- Examples/test-suite/ignore_parameter.i | 4 ++++ Examples/test-suite/python/ignore_parameter_runme.py | 1 + Examples/test-suite/ruby/ignore_parameter_runme.rb | 1 + 3 files changed, 6 insertions(+) diff --git a/Examples/test-suite/ignore_parameter.i b/Examples/test-suite/ignore_parameter.i index b3633bd97..5650f388c 100644 --- a/Examples/test-suite/ignore_parameter.i +++ b/Examples/test-suite/ignore_parameter.i @@ -11,6 +11,10 @@ %typemap(argout) int bb "called_argout = 1;" %ignore unignorable; +// Don't let SWIG expand this function with its default parameter: instead, +// always "require" the version of the function with a single argument, but +// then ignore it using `numinputs=0`. +%ignore audi(); %inline %{ // constant for detecting correct "argout" call diff --git a/Examples/test-suite/python/ignore_parameter_runme.py b/Examples/test-suite/python/ignore_parameter_runme.py index 2b5c21235..0f40f96c8 100644 --- a/Examples/test-suite/python/ignore_parameter_runme.py +++ b/Examples/test-suite/python/ignore_parameter_runme.py @@ -16,6 +16,7 @@ check(car.astonmartin("foo", 1), 101) check(car.bugatti("bar", 2), 8.8) check(car.lamborghini(), 101) check(car.maseratti(289), 289) +check(car.audi(), 8.8) # Typemap overrides default argument MiniCooper(200, 0) MorrisMinor("baz", 0) diff --git a/Examples/test-suite/ruby/ignore_parameter_runme.rb b/Examples/test-suite/ruby/ignore_parameter_runme.rb index c5466a2a6..1d1e0bac0 100644 --- a/Examples/test-suite/ruby/ignore_parameter_runme.rb +++ b/Examples/test-suite/ruby/ignore_parameter_runme.rb @@ -25,6 +25,7 @@ raise RuntimeError unless sc.daimler(0, 1.0) == "hello" raise RuntimeError unless sc.astonmartin("foo", 1.0) == 101 raise RuntimeError unless sc.bugatti("foo", 0) == 8.8 raise RuntimeError unless sc.lamborghini() == 101 +raise RuntimeError unless sc.audi() == 8.8 # Constructor tests MiniCooper.new(0, 1.0)