Fix a few bugs in the tcl module related to clientdata propagation.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6357 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-10-07 02:31:14 +00:00
commit 0e57357472
16 changed files with 257 additions and 63 deletions

View file

@ -0,0 +1,2 @@
clientdata_prop_a
clientdata_prop_b

View file

@ -0,0 +1,12 @@
class A {
public:
void fA() {}
};
typedef A tA;
void test_A(A *a) {}
void test_tA(tA *a) {}
tA *new_tA() { return new tA(); }

View file

@ -0,0 +1,12 @@
/* This file tests the clientdata propagation at swig wrapper
generation. It tests a bug in the TCL module where the
clientdata was not propagated correctly to all classes */
%module clientdata_prop_a
%{
#include "clientdata_prop_a.h"
%}
%include "clientdata_prop_a.h"
%newobject new_tA;

View file

@ -0,0 +1,38 @@
#include "clientdata_prop_a.h"
typedef tA t2A;
typedef A t3A;
class B : public A
{
public:
void fB() {}
};
class C : public tA
{
public:
void fC() {}
};
class D : public t2A
{
public:
void fD() {}
};
typedef D tD;
typedef tD t2D;
void test_t2A(t2A *a) {}
void test_t3A(t3A *a) {}
void test_B(B *b) {}
void test_C(C *c) {}
void test_D(D *d) {}
void test_tD(tD *d) {}
void test_t2D(t2D *d) {}
t2A *new_t2A() { return new t2A(); }
t3A *new_t3A() { return new t3A(); }
tD * new_tD () { return new tD (); }
t2D *new_t2D() { return new t2D(); }

View file

@ -0,0 +1,20 @@
/* This file tests the clientdata propagation at swig wrapper
generation. It tests a bug in the TCL module where the
clientdata was not propagated correctly to all classes */
%module clientdata_prop_b
%{
#include "clientdata_prop_b.h"
%}
%import "clientdata_prop_a.i"
%include "clientdata_prop_b.h"
%types(tA *);
%newobject new_t2A;
%newobject new_t3A;
%newobject new_tD;
%newobject new_t2D;

View file

@ -0,0 +1 @@
%module clientdata_prop_runtime

View file

@ -323,6 +323,7 @@ C_TEST_CASES += \
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest.)
MULTI_CPP_TEST_CASES += \
clientdata_prop \
imports \
template_typedef_import

View file

@ -0,0 +1,88 @@
if [ catch { load ./clientdata_prop_b[info sharedlibextension] clientdata_prop_b} err_msg ] {
puts stderr "Could not load shared object:\n$err_msg"
exit 1
}
if [ catch { load ./clientdata_prop_a[info sharedlibextension] clientdata_prop_a} err_msg ] {
puts stderr "Could not load shared object:\n$err_msg"
exit 1
}
A a
test_A a
test_tA a
test_t2A a
test_t3A a
a fA
B b
test_A b
test_tA b
test_t2A b
test_t3A b
test_B b
b fA
b fB
C c
test_A c
test_tA c
test_t2A c
test_t3A c
test_C c
c fA
c fC
D d
test_A d
test_tA d
test_t2A d
test_t3A d
test_D d
test_tD d
test_t2D d
d fA
d fD
set a2 [new_tA]
test_A $a2
test_tA $a2
test_t2A $a2
test_t3A $a2
$a2 fA
set a3 [new_t2A]
test_A $a3
test_tA $a3
test_t2A $a3
test_t3A $a3
$a3 fA
set a4 [new_t3A]
test_A $a4
test_tA $a4
test_t2A $a4
test_t3A $a4
$a4 fA
set d2 [new_tD]
test_A $d2
test_tA $d2
test_t2A $d2
test_t3A $d2
test_D $d2
test_tD $d2
test_t2D $d2
$d2 fA
$d2 fD
set d3 [new_t2D]
test_A $d3
test_tA $d3
test_t2A $d3
test_t3A $d3
test_D $d3
test_tD $d3
test_t2D $d3
$d3 fA
$d3 fD

View file

@ -1,15 +1,19 @@
# This is the imports runtime testcase.
if [ catch { load ./imports_a[info sharedlibextension] imports_a} err_msg ] {
if [ catch { load ./imports_b[info sharedlibextension] imports_b} err_msg ] {
puts stderr "Could not load shared object:\n$err_msg"
exit 1
}
if [ catch { load ./imports_b[info sharedlibextension] imports_b} err_msg ] {
if [ catch { load ./imports_a[info sharedlibextension] imports_a} err_msg ] {
puts stderr "Could not load shared object:\n$err_msg"
exit 1
}
set x [new_B]
A_hello $x
if [ catch { $x nonexistant } ] {
} else {
puts stderr "nonexistant method did not throw exception\n"
exit 1
}