diff --git a/Examples/test-suite/ignore_parameter.i b/Examples/test-suite/ignore_parameter.i index 4d9ee0ea2..72db2fff6 100644 --- a/Examples/test-suite/ignore_parameter.i +++ b/Examples/test-suite/ignore_parameter.i @@ -2,15 +2,15 @@ %module ignore_parameter -%typemap(in,numinputs=0) char* a (int unique = 0) { - static const char* hi = "hello"; - $1 = const_cast(hi); - unique++; - if (unique != 1) { - fprintf(stderr, "in typemap applied more than once\n"); - abort(); - } -} +%typemap(in,numinputs=0) char* a %{ + /* Catch if a target language substitutes this typemap more than once in + * the same wrapper method - this will lead to an error due to this label + * being redefined. + */ + goto redefinition_error_means_in_typemap_substituted_more_than_once; + redefinition_error_means_in_typemap_substituted_more_than_once: + $1 = const_cast("hello"); +%} %typemap(in,numinputs=0) int bb "$1 = 101; called_argout = 0;" %typemap(in,numinputs=0) double ccc "$1 = 8.8;" diff --git a/Examples/test-suite/javascript/ignore_parameter_runme.js b/Examples/test-suite/javascript/ignore_parameter_runme.js index 08f0b25bc..07dcf2f7d 100644 --- a/Examples/test-suite/javascript/ignore_parameter_runme.js +++ b/Examples/test-suite/javascript/ignore_parameter_runme.js @@ -1,24 +1,20 @@ const ignore_parameter = require('ignore_parameter'); -function check(a, b, argout) { +function check(a, b) { if (a !== b) throw new Error(`'${a}' != '${b}`); - if (argout) { - if (ignore_parameter.called_argout !== 1) - throw new Error('argout typemap not applied'); - } } check(ignore_parameter.jaguar(200, 0), "hello"); -check(ignore_parameter.lotus("foo", 1), 101, true); +check(ignore_parameter.lotus("foo", 1), 101); check(ignore_parameter.tvr("bar", 2), 8.8); -check(ignore_parameter.ferrari(), 101, true); +check(ignore_parameter.ferrari(), 101); check(ignore_parameter.fiat(17), 17); car = new ignore_parameter.SportsCars(); check(car.daimler(200, 0), "hello"); -check(car.astonmartin("foo", 1), 101, true); +check(car.astonmartin("foo", 1), 101); check(car.bugatti("bar", 2), 8.8); -check(car.lamborghini(), 101, true); +check(car.lamborghini(), 101); check(car.maseratti(289), 289); check(car.audi(), 8.8);