diff options
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/test-suite/argcargvtest.i | 2 | ||||
-rw-r--r-- | Examples/test-suite/go/argcargvtest_runme.go | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/Examples/test-suite/argcargvtest.i b/Examples/test-suite/argcargvtest.i index 5711441d9..e14e370d8 100644 --- a/Examples/test-suite/argcargvtest.i +++ b/Examples/test-suite/argcargvtest.i @@ -1,6 +1,6 @@ %module argcargvtest -#if !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGGO) && !defined(SWIGGUILE) && !defined(SWIGJAVA) && !defined(SWIGJAVASCRIPT) && !defined(SWIGMZSCHEME) && !defined(SWIGOCAML) && !defined(SWIGR) && !defined(SWIGSCILAB) +#if !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGGUILE) && !defined(SWIGJAVA) && !defined(SWIGJAVASCRIPT) && !defined(SWIGMZSCHEME) && !defined(SWIGOCAML) && !defined(SWIGR) && !defined(SWIGSCILAB) %include <argcargv.i> %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } diff --git a/Examples/test-suite/go/argcargvtest_runme.go b/Examples/test-suite/go/argcargvtest_runme.go new file mode 100644 index 000000000..3da3d76dd --- /dev/null +++ b/Examples/test-suite/go/argcargvtest_runme.go @@ -0,0 +1,22 @@ +package main + +import wrap "swigtests/argcargvtest" + +func main() { + largs := []string{"hi", "hola", "hello"} + if ri := wrap.Mainc(largs); ri != 3 { + panic(ri) + } + + targs := []string{"hi", "hola"} + if rs := wrap.Mainv(targs, 1); rs != "hola" { + panic(rs) + } + +// For dynamically typed languages we test this throws an exception or similar +// at runtime, but for Go this doesn't even compile (but we can't easily +// test for that here). +// wrap.Mainv("hello", 1) + + wrap.InitializeApp(largs) +} |