diff options
author | Momtchil Momtchev <momtchil@momtchev.com> | 2023-04-23 22:31:28 +0200 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2023-05-06 10:54:14 +0100 |
commit | 33b483492008b05b0625efb62cebb9ad5ae0638f (patch) | |
tree | 8a235064aed1463a158bdbd5bdd7ec22099d1d9a /Examples | |
parent | e92ffa84ef84429179c2a1a2a075b3c5cb61535f (diff) | |
download | swig-33b483492008b05b0625efb62cebb9ad5ae0638f.tar.gz |
add an unit test
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/test-suite/javascript/struct_typedef_namespace_runme.js | 7 | ||||
-rw-r--r-- | Examples/test-suite/struct_typedef_namespace.i | 21 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Examples/test-suite/javascript/struct_typedef_namespace_runme.js b/Examples/test-suite/javascript/struct_typedef_namespace_runme.js new file mode 100644 index 000000000..4f142121b --- /dev/null +++ b/Examples/test-suite/javascript/struct_typedef_namespace_runme.js @@ -0,0 +1,7 @@ +var struct_typedef_namespace = require("struct_typedef_namespace"); + +var b = new struct_typedef_namespace.AffineMatrix(); +b.x = b.y = b.z = 1; + +if (struct_typedef_namespace.fn1(b) != b.x) + throw new Error('failed'); diff --git a/Examples/test-suite/struct_typedef_namespace.i b/Examples/test-suite/struct_typedef_namespace.i new file mode 100644 index 000000000..921d50236 --- /dev/null +++ b/Examples/test-suite/struct_typedef_namespace.i @@ -0,0 +1,21 @@ +%module typedefs + +%inline +%{ +namespace nspace1 { + typedef struct _AffineMatrix { + int x, y, z; + } AffineMatrix; + + struct _CacheView { + int x; + }; + typedef struct _CacheView CacheView; +} + +using nspace1::AffineMatrix; +using nspace1::CacheView; + +int fn1(AffineMatrix a) { return a.x; }; +int fn2(CacheView a) { return a.x; }; +%}
\ No newline at end of file |