From 048281b9f80373f217566dcdbae6770755c3129a Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Tue, 4 Feb 2003 16:15:09 +0000 Subject: [PATCH] new test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4251 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 1 + Examples/test-suite/python/varargs_runme.py | 8 ++++++++ Examples/test-suite/varargs.i | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 Examples/test-suite/python/varargs_runme.py create mode 100644 Examples/test-suite/varargs.i diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 464f9d882..f0ee6713e 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -210,6 +210,7 @@ CPP_TEST_CASES += \ using_private \ using_protected \ valuewrapper_base \ + varargs \ virtual_destructor \ voidtest diff --git a/Examples/test-suite/python/varargs_runme.py b/Examples/test-suite/python/varargs_runme.py new file mode 100644 index 000000000..2addccb93 --- /dev/null +++ b/Examples/test-suite/python/varargs_runme.py @@ -0,0 +1,8 @@ +import varargs + +if varargs.test("Hello") != "Hello": + raise RuntimeError, "Failed" + +f = varargs.Foo() +if f.test("Hello") != "Hello": + raise RuntimeError, "Failed" diff --git a/Examples/test-suite/varargs.i b/Examples/test-suite/varargs.i new file mode 100644 index 000000000..cecea4f98 --- /dev/null +++ b/Examples/test-suite/varargs.i @@ -0,0 +1,17 @@ +// Tests SWIG's *default* handling of varargs. The default behavior is to simply ignore the varargs. +%module varargs + +%inline %{ + +char *test(const char *fmt, ...) { + return (char *) fmt; +} + +class Foo { +public: + char *test(const char *fmt, ...) { + return (char *) fmt; + } +}; + +%}