summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2023-05-05 23:23:42 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2023-05-06 11:13:23 +0100
commit65be8812959aa0d2e9805e31549bbeac0cc89691 (patch)
tree0f7d8762c507517905f5344f57db725e96c263eb /Examples
parent33b483492008b05b0625efb62cebb9ad5ae0638f (diff)
downloadswig-65be8812959aa0d2e9805e31549bbeac0cc89691.tar.gz
Partial revert of previous commit for typedefs
Setting current symbol table for a typedef seems wrong. No difference to test-suite though. Testcase rename for C++11 testing and minor adjustments. Issue #2550 Closes #2551
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/common.mk1
-rw-r--r--Examples/test-suite/cpp11_using_typedef_struct.i (renamed from Examples/test-suite/struct_typedef_namespace.i)10
-rw-r--r--Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js13
-rw-r--r--Examples/test-suite/javascript/struct_typedef_namespace_runme.js7
4 files changed, 19 insertions, 12 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index eb80977f7..c781bd930 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -636,6 +636,7 @@ CPP11_TEST_CASES += \
cpp11_uniform_initialization \
cpp11_unrestricted_unions \
cpp11_userdefined_literals \
+ cpp11_using_typedef_struct \
cpp11_variadic_function_templates \
cpp11_variadic_templates \
diff --git a/Examples/test-suite/struct_typedef_namespace.i b/Examples/test-suite/cpp11_using_typedef_struct.i
index 921d50236..81efdc310 100644
--- a/Examples/test-suite/struct_typedef_namespace.i
+++ b/Examples/test-suite/cpp11_using_typedef_struct.i
@@ -1,16 +1,16 @@
-%module typedefs
+%module cpp11_using_typedef_struct
%inline
%{
namespace nspace1 {
- typedef struct _AffineMatrix {
+ typedef struct _xAffineMatrix {
int x, y, z;
} AffineMatrix;
- struct _CacheView {
+ struct _xCacheView {
int x;
};
- typedef struct _CacheView CacheView;
+ typedef struct _xCacheView CacheView;
}
using nspace1::AffineMatrix;
@@ -18,4 +18,4 @@ using nspace1::CacheView;
int fn1(AffineMatrix a) { return a.x; };
int fn2(CacheView a) { return a.x; };
-%} \ No newline at end of file
+%}
diff --git a/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js b/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js
new file mode 100644
index 000000000..43a26ddcd
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js
@@ -0,0 +1,13 @@
+var cpp11_using_typedef_struct = require("cpp11_using_typedef_struct");
+
+var b = new cpp11_using_typedef_struct.AffineMatrix();
+b.x = b.y = b.z = 1;
+
+if (cpp11_using_typedef_struct.fn1(b) != b.x)
+ throw new Error('failed');
+
+var bb = new cpp11_using_typedef_struct._xCacheView();
+bb.x = 123;
+
+if (cpp11_using_typedef_struct.fn2(bb) != 123)
+ throw new Error('failed');
diff --git a/Examples/test-suite/javascript/struct_typedef_namespace_runme.js b/Examples/test-suite/javascript/struct_typedef_namespace_runme.js
deleted file mode 100644
index 4f142121b..000000000
--- a/Examples/test-suite/javascript/struct_typedef_namespace_runme.js
+++ /dev/null
@@ -1,7 +0,0 @@
-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');