diff options
author | Olly Betts <olly@survex.com> | 2023-04-20 09:52:36 +1200 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2023-04-20 09:55:15 +1200 |
commit | e55a5f2da30cb2ce8bb55af05e92b6da2c52e38a (patch) | |
tree | c21fa702fbc005d2ee49045fb438cce841d4b614 /Examples | |
parent | c60797e684828556f279eeec295a0b1cb50db832 (diff) | |
parent | 0e0e2fffb97d39ff52e2d3c68a4d30c38c692630 (diff) | |
download | swig-e55a5f2da30cb2ce8bb55af05e92b6da2c52e38a.tar.gz |
Merge branch 'go-argcargv'
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) +} |