Add test "constructor_copy".

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13778 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Oliver Buchtala 2012-09-08 01:01:57 +00:00
commit eff094ef39
3 changed files with 43 additions and 1 deletions

View file

@ -73,7 +73,7 @@ public:
%include "std_vector.i"
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);
%ignore std::vector<Space::Flow>::resize(size_type);

View file

@ -29,6 +29,7 @@ CPP_TEST_CASES = \
class_scope_weird \
complextest \
constover \
constructor_copy \
cpp_enum \
cpp_namespace \
cpp_static \

View file

@ -0,0 +1,41 @@
f1 = new constructor_copy.Foo1(3);
f11 = new constructor_copy.Foo1(f1);
if (f1.x != f11.x) {
throw "error in ctor copy for Foo1";
}
var good = 0;
f8 = new constructor_copy.Foo8()
try {
f81 = new constructor_copy.Foo8(f8);
good = 0;
} catch (err) {
good = 1;
}
if (good == 0) {
throw "Error: should not allow calling copy ctor for Foo8";
}
bi = new constructor_copy.Bari(5);
bc = new constructor_copy.Bari(bi);
if (bi.x != bc.x) {
throw "Error in copy ctor of Bari";
}
bd = new constructor_copy.Bard(5);
try {
bc = new constructor_copy.Bard(bd);
good = 0;
} catch (err) {
good = 1;
}
if (good == 0) {
throw "Error: should not allow calling copy ctor for Bard";
}