summaryrefslogtreecommitdiff
path: root/Examples/test-suite
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2014-05-01 22:32:14 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2014-05-01 22:32:14 +0100
commit6d86fb173915867bd70d6780a174bce3c5b3c1df (patch)
tree7c913144a4f54f20f01c35ece3ac88e02f15a19f /Examples/test-suite
parente6485d3ff2efa377b6a42008a6027fe2ebdc4f1a (diff)
parent6b25dfda60cea903311b9b807cd29fed648c9364 (diff)
downloadswig-6d86fb173915867bd70d6780a174bce3c5b3c1df.tar.gz
Merge branch 'master' into coverity-scan
* master: (378 commits) Restore full Travis testing since javascript branch merge Revert "Remove unnecessary Javascript installs on Travis" Remove unnecessary Javascript installs on Travis Javascript cosmetic changes Fix some typos Javascript: ensure banner appears before %begin code [PHP] The generated __isset() method now returns true for read-only properties. Eliminate needless casting away const from string constants Fix typos Enable Javascript in director_nspace_director_name_collision.i. Make javascript 'nspace' conform to corresponding lua example. Added some documentation on using 'node-webkit'. Fix missing ")" in code example Fix comment typos Fix m4 quoting of checks for yodl2man and yodl2html versions Enable javascript examples 'exception', 'namespace'. Fix bug and regression in javascript namespace generator. Prettify generated output in JS emitters. Fix node-gyp configuration for example 'exception'. Fix regression of 226da4. Print error when specified multiple js engines. Removed obsolete 'node.i'. Added a comment about V8_VERSION macro. Restore missing copyright info in javascript branch beautify javascript.cxx Javascript variable naming convention corrections Javascript test-suite - warning suppression not needed Javascript example Makefiles more consistent with other languages Cosmetic code changes in javascript.cxx Fix regression in Javascript generator for enums. Fix configuration for Javascript/node ctests. SKIP_JAVASCRIPT only when there is none of v8/node/jsc. Fix generator for Javascript enums. Turn on Swig_cparse_cplusplusout for Javascript/v8. Fix configuration for ctest with Javascript/v8. Add cast to test 'string_simple' to avoid C++ compiler error. Add 'fix' for Javascript/v8 to test 'enum_forward'. Fixed errors from previous commit. Removed all unnecessary asserts Remove unused variable Another go html fix Fix intgosize arg documentation Optimize metamethods inheritance resolving Updating documentation Only disable javascript tests if node-gyp is missing when testing node Revert "Javascript node test-suite makefile fixes for parallel make" Suppress keyword warning in test-suite Restore and fix infinity testcase for Javascript Simple C string test Javascript node test-suite makefile fixes for parallel make Restore missing make code in javascript branch Javascript test-suite makefile update ADD RUNPIPE and RUNTOOL to Javascript examples Remove unnecessary blank lines from Javascript examples Detect node-gyp at configure time and show version in javascript_version target Fix typo in Javascript exception Whitespace cleanup of Example Makefiles .gitignore: ignore Lib/swigwarn.swg Revert css style changes in javascript branch Add missing license info Javascript html documentation tidy up Improve missing JS engine error message a few Javascript clarifications in configure.ac Makefile and autoconf file tidy up for Javascript Fixing unused variable warnings Finish implementation with proxy functions Tidy up Example makefile for Javascript Alphabetical order for Javascript in -help output Remove junk files Remove duplicate declarations of strtoimax and strtoumax in inttypes.i Ignored enum fixes. Further shift operator regression fixes Fix use of shift operators in expressions regression since 3.0.0 Fix seg fault with extra ) brackets and >> More efficient end of template bracket (>>) handling beautify scanner.c Tidy up scanner.c DOH readme correction Fix typo in -lua -help output Remove extra </div> Update documentation for deprecation and removal of Close() Fix segfault when there are too many closing round brackets in parsed code Refix operator<< definition giving a syntax error Fix regression in 3.0.0 where legal code following an operator<< definition might give a syntax error. Remove unnecessary block from PHP version of SWIG_exception macro [PHP] Fix wrapping director constructors with default parameters with a ZTS-enabled build of PHP. Travis file code consistency Turn on Travis testing on javascript branch Add javascript to Sections.html Optimized travis before_install for Javascript. Document Javascript related preprocessor macros. Updated Javascript documentation. Insert a workaround for c_delete and c_delete_function for v8. Update Javascript.html. Remove inadvertently added xcode file. Remove gdb pretty printing. Remove cmake relict. Remove pandoc toolchain. Remove Javascript documentation source file. Revert "Development version for travis configuration." Fix travis configuration. Fix regression in custom v8 interpreter. Development version for travis configuration. Generalized smoke test configuration. Add 'version' target for javascript. Merged branch 'devel' from https://github.com/oliver----/swig-v8 (squashed commit): Add check to skip javascript test-suite if default interpreter is not installed. Activate travis matrix for different Javascript interpreters. Beautified Javascript module. Fix regressions. Removed obsolete paragraph from Javascript documentation. Fix pandoc filter. Minor tweaks in Javascript documentation. Adding a chapter about Javascript tests and examples. Minor change in Javascript configuration. Fix issues that were observed with newer JavascriptCore. Add missing copy ctor for Javascript Code Template class. Removed CMake. Fix regression in Javascript configuration. Fix regressions in configuration of some Javascript examples. More gitignores filtering Javascript related files. Fix custom javascript interpreter configuration for OSX. Make examples work with node.js and the custom interpreter. Introduced an extra Makefile for the custom javascript interpreter. Fix travis configuration. Added a comment. Fix regressions in Javascript example configuration. Fix issue with strange constants under OSX. Some fixes in example section of Javascript documentation. Add note about '-node' command line flag for Node.js code generation. Added examples to Javascript module documentation. Simplification in common javascript example Makefile. Add an extra argument for enabling nodejs support. Add more notes about how to install node. Better error message when no Javascript emitter is specified. Deactivated broken JS examples. Refactored configuration for javascript examples. Beginning to document v8 integration. Documented extending Node.js and Webkit's Javascript engine. Pandoc filter detects shell blocks when not explicitely given. Conitnued documenting the Javascript module. Not a real change. Add a pandoc filter to create compatible html. Add Javascript to chapters. More Javascript module documentation. Next iteration on creating a documentation for the Javascript module. Next iteration on creating a documentation for the Javascript module. Travis configuration for Javascript branch. Javascript examples. Javascript documentation. CMake configuration. Fix regression. Fix test configuration. Trying to install former working version of nodejs. Fix test configuration for nodejs. Add stub std_deque.i files. Add non pretty printing function to Templates. Fix bug with typedefd function pointers. Add some test runners. Fix emitter for member pointer constants. Fix %nspace support and activated relevant tests. Disable warnings for some v8 test-cases. Fix regression. Bugfix in argument marshalling. Disable testcase 'typemap_variables' for v8. Bugfix for Javascript generator. Replace $symname in generated function wrappers. Add missing macros. Let v8 generated code include stdlib.h Add cdata.i typemaps. Rearrange generation of init block to have custom init code within the initializer body. Make JSC inheritance definition more robust. Removed dead code. Bugfix for JSC %typemap(out) std::string&. Fix typemap declarations for (unsigned) long long. Add support for IN/OUTPUT typemaps. removed Clear before Dispose from newer v8 code, consider the following code: template <class T> void Persistent<T>::Dispose() { if (this->IsEmpty()) return; //Clear will trigger this V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_)); ... } fixed newer v8 compilation Add stub 'typemaps.i' files. Bugfix Javascript generator: valid name for dispatcher functions. Fix Javascript generator for smartpointeraccessed variables. Bugfix for Javascript generator: avoid duplicate action code generation. Bugfix in Javascript generator: detect member setter/getters correctly. Fix configuration for nodejs based tests. Some fixes and cleanup in Javascript generator. Fix settings for building nodejs tests. Add support for PackedData to Javascript generator. Added two more Javascript tests. Some fixes for the Javascript generator. Redefined set of Javascript smoke tests. Clean up in `javascripttypemaps.swg`. Fix v8 generator to use a non clashing name for built-in 'equals' method. Fix Javascript generator to use %renamed variable names. Activate Javascript test-cases `rename_simple` and `rename_scope`. Activate Javascript testcases `rename1-4`. Add `infinity` test-case to list of smoke tests. Added unit test using C99 INFINITY. This test actually tests a float conversion bug where converting to float imposed overflow checking which should not be there and causes this program to error out. This was seen originally in Javascript, but it turns out Python has the same bug. Lua does not have this bug. Other generators have not been tested. Bug-fix for static variables as proposed by Kota Iguchi. Let Travis test all three targets. Allow to run the test suite with our list of smoke tests. ... Conflicts: .travis.yml
Diffstat (limited to 'Examples/test-suite')
-rw-r--r--Examples/test-suite/c_delete.i4
-rw-r--r--Examples/test-suite/c_delete_function.i4
-rw-r--r--Examples/test-suite/common.mk3
-rw-r--r--Examples/test-suite/constructor_copy.i2
-rw-r--r--Examples/test-suite/cpp11_template_double_brackets.i14
-rw-r--r--Examples/test-suite/cpp_basic.i13
-rw-r--r--Examples/test-suite/d/operator_overload_runme.2.d2
-rw-r--r--Examples/test-suite/director_nspace.i2
-rw-r--r--Examples/test-suite/director_nspace_director_name_collision.i2
-rw-r--r--Examples/test-suite/enum_forward.i4
-rw-r--r--Examples/test-suite/enum_ignore.i20
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.i6
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.stderr1
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets2.i9
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets2.stderr1
-rw-r--r--Examples/test-suite/infinity.i47
-rwxr-xr-xExamples/test-suite/javascript/Makefile.in114
-rw-r--r--Examples/test-suite/javascript/abstract_access_runme.js6
-rw-r--r--Examples/test-suite/javascript/abstract_inherit_runme.js40
-rw-r--r--Examples/test-suite/javascript/abstract_typedef2_runme.js6
-rw-r--r--Examples/test-suite/javascript/abstract_typedef_runme.js8
-rw-r--r--Examples/test-suite/javascript/abstract_virtual_runme.js11
-rw-r--r--Examples/test-suite/javascript/array_member_runme.js22
-rw-r--r--Examples/test-suite/javascript/arrays_global_runme.js18
-rw-r--r--Examples/test-suite/javascript/callback_runme.js30
-rw-r--r--Examples/test-suite/javascript/char_binary_runme.js38
-rw-r--r--Examples/test-suite/javascript/char_strings_runme.js11
-rw-r--r--Examples/test-suite/javascript/class_ignore_runme.js6
-rw-r--r--Examples/test-suite/javascript/class_scope_weird_runme.js6
-rw-r--r--Examples/test-suite/javascript/complextest_runme.js22
-rw-r--r--Examples/test-suite/javascript/constover_runme.js33
-rw-r--r--Examples/test-suite/javascript/constructor_copy_runme.js42
-rw-r--r--Examples/test-suite/javascript/cpp_enum_runme.js28
-rw-r--r--Examples/test-suite/javascript/cpp_namespace_runme.js47
-rw-r--r--Examples/test-suite/javascript/cpp_static_runme.js9
-rw-r--r--Examples/test-suite/javascript/director_alternating_runme.js5
-rw-r--r--Examples/test-suite/javascript/disown_runme.js22
-rw-r--r--Examples/test-suite/javascript/dynamic_cast_runme.js12
-rw-r--r--Examples/test-suite/javascript/empty_runme.js1
-rw-r--r--Examples/test-suite/javascript/enum_template_runme.js8
-rw-r--r--Examples/test-suite/javascript/infinity_runme.js4
-rw-r--r--Examples/test-suite/javascript/namespace_virtual_method_runme.js3
-rw-r--r--Examples/test-suite/javascript/node_template/binding.gyp.in30
-rw-r--r--Examples/test-suite/javascript/node_template/index.js.in1
-rw-r--r--Examples/test-suite/javascript/nspace_extend_runme.js27
-rw-r--r--Examples/test-suite/javascript/nspace_runme.js76
-rw-r--r--Examples/test-suite/javascript/overload_copy_runme.js4
-rw-r--r--Examples/test-suite/javascript/preproc_include_runme.js23
-rw-r--r--Examples/test-suite/javascript/preproc_runme.js14
-rw-r--r--Examples/test-suite/javascript/rename1_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename2_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename3_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename4_runme.js68
-rw-r--r--Examples/test-suite/javascript/rename_scope_runme.js17
-rw-r--r--Examples/test-suite/javascript/rename_simple_runme.js50
-rw-r--r--Examples/test-suite/javascript/ret_by_value_runme.js8
-rw-r--r--Examples/test-suite/javascript/setup_test.sh6
-rw-r--r--Examples/test-suite/javascript/string_simple_runme.js10
-rw-r--r--Examples/test-suite/javascript/struct_value_runme.js11
-rw-r--r--Examples/test-suite/javascript/template_static_runme.js3
-rw-r--r--Examples/test-suite/javascript/typedef_class_runme.js7
-rw-r--r--Examples/test-suite/javascript/typedef_inherit_runme.js23
-rw-r--r--Examples/test-suite/javascript/typedef_scope_runme.js12
-rw-r--r--Examples/test-suite/javascript/typemap_arrays_runme.js5
-rw-r--r--Examples/test-suite/javascript/typemap_delete_runme.js5
-rw-r--r--Examples/test-suite/javascript/typemap_namespace_runme.js7
-rw-r--r--Examples/test-suite/javascript/typemap_ns_using_runme.js4
-rw-r--r--Examples/test-suite/javascript/using1_runme.js4
-rw-r--r--Examples/test-suite/javascript/using2_runme.js4
-rw-r--r--Examples/test-suite/javascript/varargs_runme.js44
-rw-r--r--Examples/test-suite/lua/cpp_basic_runme.lua10
-rw-r--r--Examples/test-suite/lua/operator_overload_runme.lua32
-rw-r--r--Examples/test-suite/nspace.i2
-rw-r--r--Examples/test-suite/nspace_extend.i2
-rw-r--r--Examples/test-suite/operator_overload.i4
-rw-r--r--Examples/test-suite/php/arrays_runme.php1
-rw-r--r--Examples/test-suite/string_simple.i13
77 files changed, 1404 insertions, 13 deletions
diff --git a/Examples/test-suite/c_delete.i b/Examples/test-suite/c_delete.i
index 632340629..0c69f9f41 100644
--- a/Examples/test-suite/c_delete.i
+++ b/Examples/test-suite/c_delete.i
@@ -2,9 +2,9 @@
/* check C++ delete keyword is okay in C wrappers */
-#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
+%warnfilter(SWIGWARN_PARSE_KEYWORD) delete;
-#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) /* Octave and Javascript/v8 compiles wrappers as C++ */
%inline %{
struct delete {
diff --git a/Examples/test-suite/c_delete_function.i b/Examples/test-suite/c_delete_function.i
index 3739ceadc..8164d066b 100644
--- a/Examples/test-suite/c_delete_function.i
+++ b/Examples/test-suite/c_delete_function.i
@@ -2,7 +2,9 @@
/* check C++ delete keyword is okay in C wrappers */
-#if !defined(SWIGOCTAVE) /* Octave compiles wrappers as C++ */
+%warnfilter(SWIGWARN_PARSE_KEYWORD) delete;
+
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) /* Octave and Javascript/v8 compiles wrappers as C++ */
%inline %{
double delete(double d) { return d; }
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 67f99b0b1..2a4591524 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -197,6 +197,7 @@ CPP_TEST_CASES += \
disown \
dynamic_cast \
empty \
+ enum_ignore \
enum_plus \
enum_rename \
enum_scope_template \
@@ -587,6 +588,7 @@ C_TEST_CASES += \
global_functions \
immutable_values \
inctest \
+ infinity \
integers \
keyword_rename \
lextype \
@@ -613,6 +615,7 @@ C_TEST_CASES += \
simple_array \
sizeof_pointer \
sneaky1 \
+ string_simple \
struct_rename \
struct_initialization \
typedef_struct \
diff --git a/Examples/test-suite/constructor_copy.i b/Examples/test-suite/constructor_copy.i
index bfbd706f4..8e92e7840 100644
--- a/Examples/test-suite/constructor_copy.i
+++ b/Examples/test-suite/constructor_copy.i
@@ -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);
diff --git a/Examples/test-suite/cpp11_template_double_brackets.i b/Examples/test-suite/cpp11_template_double_brackets.i
index 15fe4903b..ba5caa5c5 100644
--- a/Examples/test-suite/cpp11_template_double_brackets.i
+++ b/Examples/test-suite/cpp11_template_double_brackets.i
@@ -24,6 +24,14 @@ public:
int operator<<(ABC &) { return 0; }
};
+class DEF {
+public:
+ int a;
+ int operator<<(DEF &) { return 0; }
+ int operator>>(DEF &) { return 0; }
+};
+
+
template<class T>
class ABC2 {
public:
@@ -37,3 +45,9 @@ public:
};
%}
+// Test shifts are still working
+%inline %{
+int shift_init1 = 4 << 2 >> 1;
+int shift_init2 = 4 >> 2 << 1 << 1 >> 2;
+%}
+
diff --git a/Examples/test-suite/cpp_basic.i b/Examples/test-suite/cpp_basic.i
index bd1ec453a..a228af289 100644
--- a/Examples/test-suite/cpp_basic.i
+++ b/Examples/test-suite/cpp_basic.i
@@ -30,6 +30,19 @@ class Foo {
}
int (Foo::*func_ptr)(int);
+
+ const char* __str__() const { return "Foo"; }
+};
+
+class FooSub : public Foo {
+ public:
+ FooSub() :Foo(42) {}
+};
+
+class FooSubSub : public FooSub {
+ public:
+ FooSubSub() : FooSub() {}
+ const char* __str__() const { return "FooSubSub"; }
};
%}
diff --git a/Examples/test-suite/d/operator_overload_runme.2.d b/Examples/test-suite/d/operator_overload_runme.2.d
index 2ff61cd56..d05265e58 100644
--- a/Examples/test-suite/d/operator_overload_runme.2.d
+++ b/Examples/test-suite/d/operator_overload_runme.2.d
@@ -53,7 +53,7 @@ void main() {
assert(-a == a);
assert(-b == new Op(-5));
- // Unfortunaly, there is no way to override conversion to boolean for
+ // Unfortunately, there is no way to override conversion to boolean for
// classes in D, opCast!("bool") is only used for structs.
// test []
diff --git a/Examples/test-suite/director_nspace.i b/Examples/test-suite/director_nspace.i
index fdea75e2f..f24227c68 100644
--- a/Examples/test-suite/director_nspace.i
+++ b/Examples/test-suite/director_nspace.i
@@ -40,7 +40,7 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::Bar::Foo;
%nspace TopLevel::Bar::FooBar;
#else
diff --git a/Examples/test-suite/director_nspace_director_name_collision.i b/Examples/test-suite/director_nspace_director_name_collision.i
index 8fd27c968..190bdf4fa 100644
--- a/Examples/test-suite/director_nspace_director_name_collision.i
+++ b/Examples/test-suite/director_nspace_director_name_collision.i
@@ -34,7 +34,7 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::A::Foo;
%nspace TopLevel::B::Foo;
#else
diff --git a/Examples/test-suite/enum_forward.i b/Examples/test-suite/enum_forward.i
index 1609fa8e9..c82e17be7 100644
--- a/Examples/test-suite/enum_forward.i
+++ b/Examples/test-suite/enum_forward.i
@@ -1,7 +1,7 @@
%module enum_forward
-/* This contains C code that is not valid C++03 and Octave wrappers are always compiled as C++ */
-#if !defined(SWIGOCTAVE)
+/* This contains C code that is not valid C++03 and Octave, and Javascript(v8) wrappers are always compiled as C++ */
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
%{
enum ForwardEnum1 { AAA, BBB };
enum ForwardEnum2 { CCC, DDD };
diff --git a/Examples/test-suite/enum_ignore.i b/Examples/test-suite/enum_ignore.i
new file mode 100644
index 000000000..6d11f6a97
--- /dev/null
+++ b/Examples/test-suite/enum_ignore.i
@@ -0,0 +1,20 @@
+%module enum_ignore
+
+// Similar to enum_missing C test, but with namespaces and using %ignore
+
+%ignore N::C;
+
+%inline %{
+ namespace N {
+ enum C { Red, Green, Blue };
+
+ struct Draw {
+ void DrawBW() {}
+ void DrawC(C c) {}
+ void DrawC_Ptr(C* c) {}
+ void DrawC_ConstRef(C const& c) {}
+ };
+ }
+%}
+
+
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.i b/Examples/test-suite/errors/cpp_extra_brackets.i
new file mode 100644
index 000000000..32cf7f72d
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets.i
@@ -0,0 +1,6 @@
+%module cpp_extra_brackets
+
+// Extra brackets was segfaulting in SWIG-3.0.0
+struct ABC {
+ int operator<<(ABC &))) { return 0; }
+};
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.stderr b/Examples/test-suite/errors/cpp_extra_brackets.stderr
new file mode 100644
index 000000000..12bb1f327
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets.stderr
@@ -0,0 +1 @@
+cpp_extra_brackets.i:5: Error: Syntax error in input(3).
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.i b/Examples/test-suite/errors/cpp_extra_brackets2.i
new file mode 100644
index 000000000..17a5d5918
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.i
@@ -0,0 +1,9 @@
+%module cpp_extra_brackets
+
+// Extra brackets was segfaulting in SWIG-3.0.0
+struct ABC {
+;
+)))
+int operator<<(ABC &) { return 0; }
+int operator>>(ABC &) { return 0; }
+};
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.stderr b/Examples/test-suite/errors/cpp_extra_brackets2.stderr
new file mode 100644
index 000000000..c2eaf741c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.stderr
@@ -0,0 +1 @@
+cpp_extra_brackets2.i:6: Error: Syntax error in input(3).
diff --git a/Examples/test-suite/infinity.i b/Examples/test-suite/infinity.i
new file mode 100644
index 000000000..726150f02
--- /dev/null
+++ b/Examples/test-suite/infinity.i
@@ -0,0 +1,47 @@
+%module infinity
+
+/* C99 defines INFINITY
+ Because INFINITY may be defined by compiler built-ins, we can't use #define.
+ Instead, expose the variable MYINFINITY and then use %rename to make it INFINITY in the scripting language.
+*/
+%rename(INFINITY) MYINFINITY;
+
+%{
+#include <math.h>
+
+/* C99 math.h defines INFINITY. If not available, this is the fallback. */
+#ifndef INFINITY
+ #ifdef _MSC_VER
+ union MSVC_EVIL_FLOAT_HACK
+ {
+ unsigned __int8 Bytes[4];
+ float Value;
+ };
+ static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
+ #define INFINITY (INFINITY_HACK.Value)
+ #endif
+
+ #ifdef __GNUC__
+ #define INFINITY (__builtin_inf())
+ #elif defined(__clang__)
+ #if __has_builtin(__builtin_inf)
+ #define INFINITY (__builtin_inf())
+ #endif
+ #endif
+
+ #ifndef INFINITY
+ #define INFINITY (1e1000)
+ #endif
+#endif
+%}
+
+%inline %{
+/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
+const double MYINFINITY = INFINITY;
+
+/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */
+float use_infinity(float inf_val)
+{
+ return inf_val;
+}
+%}
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
new file mode 100755
index 000000000..7368ea9a3
--- /dev/null
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -0,0 +1,114 @@
+#######################################################################
+# Makefile for javascript test-suite
+#######################################################################
+
+LANGUAGE = javascript
+NODEGYP = @NODEGYP@
+SCRIPTSUFFIX = _runme.js
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+SWIG = $(top_builddir)/preinst_swig
+
+ifneq (, $(ENGINE))
+ JSENGINE=$(ENGINE)
+else
+ JSENGINE=node
+endif
+
+include $(srcdir)/../common.mk
+
+_setup = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
+ else \
+ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \
+ fi;
+
+ifneq (jsc,$(ENGINE))
+
+ # This test can not be run with v8 as it uses v8 API incompatible output typemaps
+ typemap_variables.cpptest:
+ echo "skipping $(LANGUAGE) ($(JSENGINE)) testcase typemap_variables" ;
+
+endif
+
+ifeq (node,$(JSENGINE))
+
+ SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1
+
+ # shut up some warnings
+ # contract macro has an empty 'else' at the end...
+ aggregate.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
+ contract.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
+
+ # dunno... ignoring generously
+ apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+
+ # Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension)
+ swig_and_compile_c = \
+ sh ./setup_test.sh $* $(GYP_CFLAGS); \
+ $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx ../$*.i; \
+ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+
+ swig_and_compile_cpp = \
+ sh ./setup_test.sh $* $(GYP_CFLAGS); \
+ $(SWIG) -c++ -javascript $(SWIGOPT) ../$*.i; \
+ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+
+ run_testcase = \
+ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
+ node $(srcdir)/$*$(SCRIPTSUFFIX); \
+ fi
+
+
+ %.ctest:
+ $(_setup)
+ $(swig_and_compile_c)
+ $(run_testcase)
+
+ %.cpptest:
+ $(_setup)
+ $(swig_and_compile_cpp)
+ $(run_testcase)
+
+ %.multicpptest:
+ $(_setup)
+
+else
+
+ SWIGOPT += -$(JSENGINE)
+
+ run_testcase = \
+ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
+ $(top_srcdir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \
+ fi
+
+ %.ctest:
+ $(_setup)
+ +$(swig_and_compile_c)
+ $(run_testcase)
+
+ %.cpptest:
+ $(_setup)
+ +$(swig_and_compile_cpp)
+ $(run_testcase)
+
+ %.multicpptest:
+ $(_setup)
+ +$(swig_and_compile_multi_cpp)
+ $(run_testcase)
+
+endif
+
+
+%.clean:
+ rm -rf $*
+
+clean:
+ rm -f *_wrap.cxx
+ rm -f *_wrap.c
+ rm -f *.so
+ rm -f *.o
diff --git a/Examples/test-suite/javascript/abstract_access_runme.js b/Examples/test-suite/javascript/abstract_access_runme.js
new file mode 100644
index 000000000..8f87d2105
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_access_runme.js
@@ -0,0 +1,6 @@
+var abstract_access = require("./abstract_access");
+
+var d = new abstract_access.D()
+if (d.do_x() != 1) {
+ throw "Error";
+}
diff --git a/Examples/test-suite/javascript/abstract_inherit_runme.js b/Examples/test-suite/javascript/abstract_inherit_runme.js
new file mode 100644
index 000000000..3af2eae74
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_inherit_runme.js
@@ -0,0 +1,40 @@
+var abstract_inherit = require("./abstract_inherit");
+
+// Shouldn't be able to instantiate any of these classes
+// since none of them implements the pure virtual function
+// declared in the base class (Foo).
+var Foo = abstract_inherit.Foo;
+var Bar = abstract_inherit.Bar;
+var Spam = abstract_inherit.Spam;
+
+var caughtException = false;
+try {
+ new Foo();
+} catch (err) {
+ caughtException = true;
+}
+if (!caughtException) {
+ throw new Error("Foo should be instantiated as it is abstract");
+}
+
+caughtException = false;
+try {
+ new Bar();
+} catch (err) {
+ caughtException = true;
+}
+
+if (!caughtException) {
+ throw new Error("Bar should be instantiated as it is abstract");
+}
+
+caughtException = false;
+try {
+ new Spam();
+} catch (err) {
+ caughtException = true;
+}
+
+if (!caughtException) {
+ throw new Error("Spam should be instantiated as it is abstract");
+}
diff --git a/Examples/test-suite/javascript/abstract_typedef2_runme.js b/Examples/test-suite/javascript/abstract_typedef2_runme.js
new file mode 100644
index 000000000..c177e49c3
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_typedef2_runme.js
@@ -0,0 +1,6 @@
+var abstract_typedef2 = require("./abstract_typedef2");
+
+var a = new abstract_typedef2.A_UF();
+
+if (a == undefined)
+ throw "Error";
diff --git a/Examples/test-suite/javascript/abstract_typedef_runme.js b/Examples/test-suite/javascript/abstract_typedef_runme.js
new file mode 100644
index 000000000..abcfc581d
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_typedef_runme.js
@@ -0,0 +1,8 @@
+var abstract_typedef = require("./abstract_typedef");
+
+var e = new abstract_typedef.Engine();
+var a = new abstract_typedef.A()
+
+if (a.write(e) != 1) {
+ throw "Error";
+}
diff --git a/Examples/test-suite/javascript/abstract_virtual_runme.js b/Examples/test-suite/javascript/abstract_virtual_runme.js
new file mode 100644
index 000000000..9e2814e41
--- /dev/null
+++ b/Examples/test-suite/javascript/abstract_virtual_runme.js
@@ -0,0 +1,11 @@
+var abstract_virtual = require("./abstract_virtual");
+
+d = new abstract_virtual.D()
+
+if (d == undefined)
+ throw "Error";
+
+e = new abstract_virtual.E()
+
+if (e == undefined)
+ throw "Error";
diff --git a/Examples/test-suite/javascript/array_member_runme.js b/Examples/test-suite/javascript/array_member_runme.js
new file mode 100644
index 000000000..8c4ef1da5
--- /dev/null
+++ b/Examples/test-suite/javascript/array_member_runme.js
@@ -0,0 +1,22 @@
+var array_member = require("./array_member");
+
+var f = new array_member.Foo();
+f.data = array_member.global_data;
+
+for (var i=0; i<8; i++) {
+ if (array_member.get_value(f.data,i) != array_member.get_value(array_member.global_data,i)) {
+ throw "Bad array assignment (1)";
+ }
+}
+
+for (var i=0; i<8; i++) {
+ array_member.set_value(f.data,i,-i);
+}
+
+array_member.global_data = f.data;
+
+for (var i=0; i<8; i++){
+ if (array_member.get_value(f.data,i) != array_member.get_value(array_member.global_data,i)) {
+ throw "Bad array assignment (2)";
+ }
+}
diff --git a/Examples/test-suite/javascript/arrays_global_runme.js b/Examples/test-suite/javascript/arrays_global_runme.js
new file mode 100644
index 000000000..fdb365f83
--- /dev/null
+++ b/Examples/test-suite/javascript/arrays_global_runme.js
@@ -0,0 +1,18 @@
+var arrays_global = require("./arrays_global");
+
+arrays_global.array_i = arrays_global.array_const_i;
+
+arrays_global.BeginString_FIX44a;
+arrays_global.BeginString_FIX44b;
+arrays_global.BeginString_FIX44c;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44b = "12"+'\0'+"45";
+arrays_global.BeginString_FIX44b;
+arrays_global.BeginString_FIX44d;
+arrays_global.BeginString_FIX44e;
+arrays_global.BeginString_FIX44f;
+
+arrays_global.test_a("hello","hi","chello","chi");
+
+arrays_global.test_b("1234567","hi");
diff --git a/Examples/test-suite/javascript/callback_runme.js b/Examples/test-suite/javascript/callback_runme.js
new file mode 100644
index 000000000..9b1ef01a3
--- /dev/null
+++ b/Examples/test-suite/javascript/callback_runme.js
@@ -0,0 +1,30 @@
+var callback = require("./callback");
+
+if (callback.foo(2) !== 2) {
+ throw new Error("Failed.");
+}
+if (callback.A_bar(2) !== 4) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.foo) != callback.foo(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, foo) != callback.foo(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.A_bar) != callback.A_bar(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar(3, callback.foof) != callback.foof(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar_i(3, callback.foo_i) != callback.foo_i(3)) {
+ throw new Error("Failed.");
+}
+if (callback.foobar_d(3.5, callback.foo_d) != callback.foo_d(3.5)) {
+ throw new Error("Failed.");
+}
+var a = new callback.A();
+if (callback.foobarm(3, a, callback.A.foom_cb_ptr) != a.foom(3)) {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js
new file mode 100644
index 000000000..42abe6060
--- /dev/null
+++ b/Examples/test-suite/javascript/char_binary_runme.js
@@ -0,0 +1,38 @@
+var char_binary = require("./char_binary");
+
+var t = new char_binary.Test();
+if (t.strlen('hile') != 4) {
+ print(t.strlen('hile'));
+ throw("bad multi-arg typemap 1");
+}
+
+if (t.strlen('hil\0') != 4) {
+ throw("bad multi-arg typemap 2");
+}
+
+/*
+ * creating a raw char*
+ */
+var pc = char_binary.new_pchar(5);
+char_binary.pchar_setitem(pc, 0, 'h');
+char_binary.pchar_setitem(pc, 1, 'o');
+char_binary.pchar_setitem(pc, 2, 'l');
+char_binary.pchar_setitem(pc, 3, 'a');
+char_binary.pchar_setitem(pc, 4, 0);
+
+
+if (t.strlen(pc) != 4) {
+ throw("bad multi-arg typemap (3)");
+}
+
+char_binary.var_pchar = pc;
+if (char_binary.var_pchar != "hola") {
+ print(char_binary.var_pchar);
+ throw("bad pointer case (1)");
+}
+
+char_binary.var_namet = pc;
+if (char_binary.var_namet != "hola") {
+ throw("bad pointer case (2)");
+}
+char_binary.delete_pchar(pc);
diff --git a/Examples/test-suite/javascript/char_strings_runme.js b/Examples/test-suite/javascript/char_strings_runme.js
new file mode 100644
index 000000000..cca50d851
--- /dev/null
+++ b/Examples/test-suite/javascript/char_strings_runme.js
@@ -0,0 +1,11 @@
+var char_strings = require("./char_strings");
+
+var assertIsEqual = function(expected, actual) {
+ if (expected !== actual) {
+ throw new Error("Expected "+expected+", was "+actual);
+ }
+};
+
+assertIsEqual("hi there", char_strings.CharPingPong("hi there"));
+assertIsEqual("hi there", char_strings.CharArrayPingPong("hi there"));
+assertIsEqual("hi there", char_strings.CharArrayDimsPingPong("hi there"));
diff --git a/Examples/test-suite/javascript/class_ignore_runme.js b/Examples/test-suite/javascript/class_ignore_runme.js
new file mode 100644
index 000000000..f0a32a1c4
--- /dev/null
+++ b/Examples/test-suite/javascript/class_ignore_runme.js
@@ -0,0 +1,6 @@
+var class_ignore = require("./class_ignore");
+
+a = new class_ignore.Bar();
+
+if (class_ignore.do_blah(a) != "Bar::blah")
+ throw "Error";
diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js
new file mode 100644
index 000000000..ac745d023
--- /dev/null
+++ b/Examples/test-suite/javascript/class_scope_weird_runme.js
@@ -0,0 +1,6 @@
+var class_scope_weird = require("./class_scope_weird");
+
+f = new class_scope_weird.Foo();
+g = new class_scope_weird.Foo(3);
+if (f.bar(3) != 3)
+ throw RuntimeError;
diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js
new file mode 100644
index 000000000..1fcc97648
--- /dev/null
+++ b/Examples/test-suite/javascript/complextest_runme.js
@@ -0,0 +1,22 @@
+var complextest = require("./complextest");
+
+a = [-1,2];
+
+expected = [-1, -2];
+
+a_c = complextest.Conj(a);
+if (a_c.toString() != expected.toString())
+ throw "Error in Conj(a)";
+
+a_c_f = complextest.Conjf(a);
+if (a_c_f.toString() != expected.toString())
+ throw "Error in Conjf(a)";
+
+v = new complextest.VectorStdCplx();
+v.add([1,2]);
+v.add([2,3]);
+v.add([4,3]);
+v.add(1);
+
+// TODO: how to check validity?
+complextest.Copy_h(v);
diff --git a/Examples/test-suite/javascript/constover_runme.js b/Examples/test-suite/javascript/constover_runme.js
new file mode 100644
index 000000000..764d8b328
--- /dev/null
+++ b/Examples/test-suite/javascript/constover_runme.js
@@ -0,0 +1,33 @@
+var constover = require("./constover");
+
+p = constover.test("test");
+if (p != "test") {
+ throw "test failed!";
+}
+
+p = constover.test_pconst("test");
+if (p != "test_pconst") {
+ throw "test_pconst failed!";
+}
+
+f = new constover.Foo();
+
+p = f.test("test");
+if (p != "test") {
+ throw "member-test failed!";
+}
+
+p = f.test_pconst("test");
+if (p != "test_pconst") {
+ throw "member-test_pconst failed!";
+}
+
+p = f.test_constm("test");
+if (p != "test_constmethod") {
+ throw "member-test_constm failed!";
+}
+
+p = f.test_pconstm("test");
+if (p != "test_pconstmethod") {
+ throw "member-test_pconstm failed!";
+}
diff --git a/Examples/test-suite/javascript/constructor_copy_runme.js b/Examples/test-suite/javascript/constructor_copy_runme.js
new file mode 100644
index 000000000..39dce52ce
--- /dev/null
+++ b/Examples/test-suite/javascript/constructor_copy_runme.js
@@ -0,0 +1,42 @@
+var constructor_copy = require("./constructor_copy");
+
+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";
+}
diff --git a/Examples/test-suite/javascript/cpp_enum_runme.js b/Examples/test-suite/javascript/cpp_enum_runme.js
new file mode 100644
index 000000000..35f7c60ac
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_enum_runme.js
@@ -0,0 +1,28 @@
+var cpp_enum = require("./cpp_enum");
+
+var f = new cpp_enum.Foo()
+
+if(f.hola != cpp_enum.Hello){
+ print(f.hola);
+ throw "Error";
+}
+
+f.hola = cpp_enum.Foo.Hi
+if(f.hola != cpp_enum.Foo.Hi){
+ print(f.hola);
+ throw "Error";
+}
+
+f.hola = cpp_enum.Hello
+
+if(f.hola != cpp_enum.Hello){
+ print(f.hola);
+ throw "Error";
+}
+
+cpp_enum.Foo.hi = cpp_enum.Hello
+if(cpp_enum.Foo.hi != cpp_enum.Hello){
+ print(cpp_enum.Foo.hi);
+ throw "Error";
+}
+
diff --git a/Examples/test-suite/javascript/cpp_namespace_runme.js b/Examples/test-suite/javascript/cpp_namespace_runme.js
new file mode 100644
index 000000000..3bdfef3e9
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_namespace_runme.js
@@ -0,0 +1,47 @@
+var cpp_namespace = require("./cpp_namespace");
+
+var n = cpp_namespace.fact(4);
+if (n != 24){
+ throw ("Bad return value error!");
+}
+if (cpp_namespace.Foo != 42){
+ throw ("Bad variable value error!");
+}
+
+t = new cpp_namespace.Test();
+if (t.method() != "Test::method"){
+ throw ("Bad method return value error!");
+}
+if (cpp_namespace.do_method(t) != "Test::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method2(t) != "Test::method"){
+ throw ("Bad return value error!");
+}
+cpp_namespace.weird("hello", 4);
+delete t;
+
+t2 = new cpp_namespace.Test2();
+t3 = new cpp_namespace.Test3();
+t4 = new cpp_namespace.Test4();
+t5 = new cpp_namespace.Test5();
+if (cpp_namespace.foo3(42) != 42){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t2,40) != "Test2::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t3,40) != "Test3::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t4,40) != "Test4::method"){
+ throw ("Bad return value error!");
+}
+
+if (cpp_namespace.do_method3(t5,40) != "Test5::method"){
+ throw ("Bad return value error!");
+}
diff --git a/Examples/test-suite/javascript/cpp_static_runme.js b/Examples/test-suite/javascript/cpp_static_runme.js
new file mode 100644
index 000000000..2579aeafe
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp_static_runme.js
@@ -0,0 +1,9 @@
+var cpp_static = require("./cpp_static");
+
+cpp_static.StaticFunctionTest.static_func();
+cpp_static.StaticFunctionTest.static_func_2(1);
+cpp_static.StaticFunctionTest.static_func_3(1,2);
+cpp_static.StaticMemberTest.static_int = 10;
+if (cpp_static.StaticMemberTest.static_int != 10)
+throw "error";
+
diff --git a/Examples/test-suite/javascript/director_alternating_runme.js b/Examples/test-suite/javascript/director_alternating_runme.js
new file mode 100644
index 000000000..a0411eace
--- /dev/null
+++ b/Examples/test-suite/javascript/director_alternating_runme.js
@@ -0,0 +1,5 @@
+var director_alternating = require("./director_alternating");
+
+id = director_alternating.getBar().id();
+if (id != director_alternating.idFromGetBar())
+ throw ("Error, Got wrong id: " + str(id));
diff --git a/Examples/test-suite/javascript/disown_runme.js b/Examples/test-suite/javascript/disown_runme.js
new file mode 100644
index 000000000..a4a6fd880
--- /dev/null
+++ b/Examples/test-suite/javascript/disown_runme.js
@@ -0,0 +1,22 @@
+var disown = require("./disown");
+
+var a = new disown.A();
+var tmp = a.thisown;
+a.thisown = 0
+if (a.thisown) {
+ throw new Error("Failed.");
+}
+a.thisown = 1
+if (!a.thisown) {
+ throw new Error("Failed.");
+}
+a.thisown = tmp
+if (a.thisown != tmp) {
+ throw new Error("Failed.");
+}
+
+var b = new disown.B();
+b.acquire(a);
+if (a.thisown) {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/dynamic_cast_runme.js b/Examples/test-suite/javascript/dynamic_cast_runme.js
new file mode 100644
index 000000000..0029cb0f8
--- /dev/null
+++ b/Examples/test-suite/javascript/dynamic_cast_runme.js
@@ -0,0 +1,12 @@
+var dynamic_cast = require("./dynamic_cast");
+
+var f = new dynamic_cast.Foo();
+var b = new dynamic_cast.Bar();
+
+var x = f.blah();
+var y = b.blah();
+
+var a = dynamic_cast.do_test(y);
+if (a != "Bar::test") {
+ throw new Error("Failed.");
+}
diff --git a/Examples/test-suite/javascript/empty_runme.js b/Examples/test-suite/javascript/empty_runme.js
new file mode 100644
index 000000000..db06b3902
--- /dev/null
+++ b/Examples/test-suite/javascript/empty_runme.js
@@ -0,0 +1 @@
+var empty = require("./empty"); \ No newline at end of file
diff --git a/Examples/test-suite/javascript/enum_template_runme.js b/Examples/test-suite/javascript/enum_template_runme.js
new file mode 100644
index 000000000..20f8c3482
--- /dev/null
+++ b/Examples/test-suite/javascript/enum_template_runme.js
@@ -0,0 +1,8 @@
+var enum_template = require("./enum_template");
+
+if (enum_template.MakeETest() != 1)
+ throw "RuntimeError";
+
+if (enum_template.TakeETest(0) != null)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/infinity_runme.js b/Examples/test-suite/javascript/infinity_runme.js
new file mode 100644
index 000000000..7b5182ff6
--- /dev/null
+++ b/Examples/test-suite/javascript/infinity_runme.js
@@ -0,0 +1,4 @@
+var infinity = require("./infinity");
+
+var my_infinity = infinity.INFINITY;
+var ret_val = infinity.use_infinity(my_infinity);
diff --git a/Examples/test-suite/javascript/namespace_virtual_method_runme.js b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
new file mode 100644
index 000000000..24d3bd487
--- /dev/null
+++ b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
@@ -0,0 +1,3 @@
+var namespace_virtual_method = require("./namespace_virtual_method");
+
+x = new namespace_virtual_method.Spam();
diff --git a/Examples/test-suite/javascript/node_template/binding.gyp.in b/Examples/test-suite/javascript/node_template/binding.gyp.in
new file mode 100644
index 000000000..209774ae0
--- /dev/null
+++ b/Examples/test-suite/javascript/node_template/binding.gyp.in
@@ -0,0 +1,30 @@
+{
+ "targets": [
+ {
+ "target_name": "$testcase",
+ "sources":[ "../$testcase_wrap.cxx" ],
+ "include_dirs": ["../.."],
+ 'defines': [
+ 'BUILDING_NODE_EXTENSION=1',
+ ],
+ 'conditions': [
+ ['OS=="mac"',
+ {
+ 'xcode_settings': {
+ 'GCC_ENABLE_CPP_RTTI': 'YES',
+ 'GCC_ENABLE_CPP_EXCEPTIONS' : 'YES'
+ }
+ }
+ ],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"',
+ {
+ 'cflags': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter", $cflags],
+ 'cflags_cc': [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", "-Wno-unused-but-set-parameter", $cflags],
+ 'cflags!': [ '-fno-exceptions' ],
+ 'cflags_cc!': [ '-fno-exceptions', '-fno-rtti' ]
+ }
+ ]
+ ],
+ }
+ ],
+}
diff --git a/Examples/test-suite/javascript/node_template/index.js.in b/Examples/test-suite/javascript/node_template/index.js.in
new file mode 100644
index 000000000..72330499d
--- /dev/null
+++ b/Examples/test-suite/javascript/node_template/index.js.in
@@ -0,0 +1 @@
+module.exports = require('./build/Release/$testcase');
diff --git a/Examples/test-suite/javascript/nspace_extend_runme.js b/Examples/test-suite/javascript/nspace_extend_runme.js
new file mode 100644
index 000000000..ab81c19d3
--- /dev/null
+++ b/Examples/test-suite/javascript/nspace_extend_runme.js
@@ -0,0 +1,27 @@
+var nspace_extend = require("./nspace_extend");
+
+// constructors and destructors
+var color1 = new nspace_extend.Outer.Inner1.Color();
+var color = new nspace_extend.Outer.Inner1.Color(color1);
+delete color1;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace_extend.Outer.Inner1.Color.colorStaticMethod(20.0);
+var created = nspace_extend.Outer.Inner1.Color.create();
+
+
+// constructors and destructors
+var color2 = new nspace_extend.Outer.Inner2.Color();
+color = new nspace_extend.Outer.Inner2.Color(color2);
+delete color2;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace_extend.Outer.Inner2.Color.colorStaticMethod(20.0);
+created = nspace_extend.Outer.Inner2.Color.create();
+
+// Same class different namespaces
+var col1 = new nspace_extend.Outer.Inner1.Color();
+var col2 = nspace_extend.Outer.Inner2.Color.create();
+col2.colors(col1, col1, col2, col2, col2);
diff --git a/Examples/test-suite/javascript/nspace_runme.js b/Examples/test-suite/javascript/nspace_runme.js
new file mode 100644
index 000000000..f1afff428
--- /dev/null
+++ b/Examples/test-suite/javascript/nspace_runme.js
@@ -0,0 +1,76 @@
+var nspace = require("./nspace");
+
+var color1 = new nspace.Outer.Inner1.Color();
+var color = new nspace.Outer.Inner1.Color(color1);
+delete color1;
+
+// class methods
+color.colorInstanceMethod(20.0);
+nspace.Outer.Inner1.Color.colorStaticMethod(20.0);
+var created = nspace.Outer.Inner1.Color.create();
+
+// class enums
+var someClass = new nspace.Outer.SomeClass();
+var channel = someClass.GetInner1ColorChannel();
+if (channel != nspace.Outer.Inner1.Color.Transmission) {
+ throw new Error("Failed.");
+}
+
+// class anonymous enums
+var val1 = nspace.Outer.Inner1.Color.ColorEnumVal1;
+var val2 = nspace.Outer.Inner1.Color.ColorEnumVal2;
+if (val1 !== 0 || val2 !== 0x22) {
+ throw new Error("Failed.");
+}
+
+// instance member variables
+color.instanceMemberVariable = 123;
+if (color.instanceMemberVariable !== 123) {
+ throw new Error("Failed.");
+}
+
+// static member variables
+nspace.Outer.Inner1.Color.staticMemberVariable = 789;
+if (nspace.Outer.Inner1.Color.staticMemberVariable !== 789) {
+ throw new Error("Failed.");
+}
+
+if (nspace.Outer.Inner1.Color.staticConstMemberVariable !== 222) {
+ throw new Error("Failed.");
+}
+
+if (nspace.Outer.Inner1.Color.staticConstEnumMemberVariable !== nspace.Outer.Inner1.Color.Transmission) {
+ throw new Error("Failed.");
+}
+
+// Same class different namespaces
+var col1 = new nspace.Outer.Inner1.Color();
+var col2 = nspace.Outer.Inner2.Color.create();
+col2.colors(col1, col1, col2, col2, col2);
+
+nspace.Outer.Inner1.namespaceFunction(color);
+nspace.Outer.Inner1.namespaceVar = 111;
+if (nspace.Outer.Inner1.namespaceVar !== 111) {
+ throw new Error("Failed.");
+}
+
+// global enums
+var outerChannel1 = someClass.GetInner1Channel();
+if (outerChannel1 != nspace.Outer.Inner1.Transmission1) {
+ throw new Error("Failed.");
+}
+
+var outerChannel2 = someClass.GetInner2Channel();
+if (outerChannel2 !== nspace.Outer.Inner2.Transmission2) {
+ throw new Error("Failed.");
+}
+
+// turn feature off / ignoring
+var ns = new nspace.Outer.namespce();
+var nons = new nspace.NoNSpacePlease();
+
+// Derived class
+var blue3 = new nspace.Outer.Inner3.Blue();
+blue3.blueInstanceMethod();
+var blue4 = new nspace.Outer.Inner4.Blue();
+blue4.blueInstanceMethod();
diff --git a/Examples/test-suite/javascript/overload_copy_runme.js b/Examples/test-suite/javascript/overload_copy_runme.js
new file mode 100644
index 000000000..1039ffda1
--- /dev/null
+++ b/Examples/test-suite/javascript/overload_copy_runme.js
@@ -0,0 +1,4 @@
+var overload_copy = require("./overload_copy");
+
+f = new overload_copy.Foo();
+g = new overload_copy.Foo(f);
diff --git a/Examples/test-suite/javascript/preproc_include_runme.js b/Examples/test-suite/javascript/preproc_include_runme.js
new file mode 100644
index 000000000..4b827fbcc
--- /dev/null
+++ b/Examples/test-suite/javascript/preproc_include_runme.js
@@ -0,0 +1,23 @@
+var preproc_include = require("./preproc_include");
+
+if (preproc_include.multiply10(10) != 100)
+ throw "RuntimeError";
+
+if (preproc_include.multiply20(10) != 200)
+ throw "RuntimeError";
+
+if (preproc_include.multiply30(10) != 300)
+ throw "RuntimeError";
+
+if (preproc_include.multiply40(10) != 400)
+ throw "RuntimeError";
+
+if (preproc_include.multiply50(10) != 500)
+ throw "RuntimeError";
+
+if (preproc_include.multiply60(10) != 600)
+ throw "RuntimeError";
+
+if (preproc_include.multiply70(10) != 700)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/preproc_runme.js b/Examples/test-suite/javascript/preproc_runme.js
new file mode 100644
index 000000000..669f9d1f0
--- /dev/null
+++ b/Examples/test-suite/javascript/preproc_runme.js
@@ -0,0 +1,14 @@
+var preproc = require("./preproc");
+
+if (preproc.endif != 1)
+ throw "RuntimeError";
+
+if (preproc.define != 1)
+ throw "RuntimeError";
+
+if (preproc.defined != 1)
+ throw "RuntimeError";
+
+if (2*preproc.one != preproc.two)
+ throw "RuntimeError";
+
diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js
new file mode 100644
index 000000000..8374e6a89
--- /dev/null
+++ b/Examples/test-suite/javascript/rename1_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename1");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js
new file mode 100644
index 000000000..bc6a95a59
--- /dev/null
+++ b/Examples/test-suite/javascript/rename2_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename2");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js
new file mode 100644
index 000000000..9e57e80ea
--- /dev/null
+++ b/Examples/test-suite/javascript/rename3_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename3");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js
new file mode 100644
index 000000000..d651fc7a1
--- /dev/null
+++ b/Examples/test-suite/javascript/rename4_runme.js
@@ -0,0 +1,68 @@
+var rename = require("./rename4");
+
+function part1() {
+ var xyz = new rename.XYZInt();
+ notxyz = new rename.NotXYZInt();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother2();
+ xyz.opT2();
+ xyz.tMethod2(0);
+ xyz.tMethodNotXYZ2(notxyz);
+ xyz.opNotXYZ2();
+ xyz.opXYZ2();
+}
+
+function part2() {
+ var xyz = new rename.XYZDouble();
+ var notxyz = new rename.NotXYZDouble();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother1();
+ xyz.opT1();
+ xyz.tMethod1(0);
+ xyz.tMethodNotXYZ1(notxyz);
+ xyz.opNotXYZ1();
+ xyz.opXYZ1();
+}
+
+function part3(){
+ var xyz = new rename.XYZKlass();
+ var notxyz = new rename.NotXYZKlass();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother3();
+ xyz.opT3();
+ xyz.tMethod3(new rename.Klass());
+ xyz.tMethodNotXYZ3(notxyz);
+ xyz.opNotXYZ3();
+ xyz.opXYZ3();
+}
+
+function part4() {
+ var xyz = new rename.XYZEnu();
+ var notxyz = new rename.NotXYZEnu();
+ xyz.opIntPtrA();
+ xyz.opIntPtrB();
+ xyz.opAnother4();
+ xyz.opT4();
+ xyz.tMethod4(rename.En1);
+ xyz.tMethodNotXYZ4(notxyz);
+ xyz.opNotXYZ4();
+ xyz.opXYZ4();
+}
+
+function part5() {
+ var abc = new rename.ABC();
+ abc.methodABC(abc);
+ var k = new rename.Klass();
+ abc.methodKlass(k);
+ var a = abc.opABC();
+ k = abc.opKlass();
+}
+
+part1();
+part2();
+part3();
+part4();
+part5();
diff --git a/Examples/test-suite/javascript/rename_scope_runme.js b/Examples/test-suite/javascript/rename_scope_runme.js
new file mode 100644
index 000000000..c0226df69
--- /dev/null
+++ b/Examples/test-suite/javascript/rename_scope_runme.js
@@ -0,0 +1,17 @@
+var rename_scope = require("./rename_scope");
+
+var a = new rename_scope.Natural_UP();
+var b = new rename_scope.Natural_BP();
+
+if (a.rtest() !== 1) {
+ throw new Error("a.rtest(): Expected 1, was " + a.rtest());
+}
+
+if (b.rtest() !== 1) {
+ throw new Error("b.rtest(): Expected 1, was " + b.rtest());
+}
+
+var f = rename_scope.equals;
+if (f === undefined) {
+ throw new Error("Equality operator has not been renamed.");
+}
diff --git a/Examples/test-suite/javascript/rename_simple_runme.js b/Examples/test-suite/javascript/rename_simple_runme.js
new file mode 100644
index 000000000..918dd68a5
--- /dev/null
+++ b/Examples/test-suite/javascript/rename_simple_runme.js
@@ -0,0 +1,50 @@
+var rename_simple = require("./rename_simple");
+var NewStruct = rename_simple.NewStruct;
+
+var s = new NewStruct();
+
+// renamed instance variable
+if (s.NewInstanceVariable !== 111) {
+ throw new Error("NewInstanceVariable: Expected 111, was " + s.NewInstanceVariable);
+}
+
+// renamed instance method
+if (s.NewInstanceMethod() !== 222) {
+ throw new Error("NewInstanceMethod(): Expected 222, was " + s.NewInstanceMethod());
+}
+
+// renamed static method
+if (NewStruct.NewStaticMethod() !== 333) {
+ throw new Error("NewInstanceMethod(): Expected 333, was " + NewStruct.NewStaticMethod());
+}
+
+// renamed static variable
+if (NewStruct.NewStaticVariable !== 444) {
+ throw new Error("NewInstanceMethod(): Expected 444, was " + NewStruct.NewStaticVariable);
+}
+
+// renamed global function
+if (rename_simple.NewFunction() !== 555) {
+ throw new Error("rename_simple.NewFunction(): Expected 555, was " + rename_simple.NewFunction());
+}
+
+// renamed global variable
+if (rename_simple.NewGlobalVariable !== 666) {
+ throw new Error("rename_simple.NewGlobalVariable: Expected 666, was " + rename_simple.NewGlobalVariable);
+}
+
+// setting renamed variables
+s.NewInstanceVariable = 1111;
+if (s.NewInstanceVariable !== 1111) {
+ throw new Error("NewInstanceVariable: Expected 1111, was " + s.NewInstanceVariable);
+}
+
+NewStruct.NewStaticVariable = 4444;
+if (NewStruct.NewStaticVariable !== 4444) {
+ throw new Error("NewInstanceMethod(): Expected 4444, was " + NewStruct.NewStaticVariable);
+}
+
+rename_simple.NewGlobalVariable = 6666;
+if (rename_simple.NewGlobalVariable !== 6666) {
+ throw new Error("rename_simple.NewGlobalVariable: Expected 6666, was " + rename_simple.NewGlobalVariable);
+}
diff --git a/Examples/test-suite/javascript/ret_by_value_runme.js b/Examples/test-suite/javascript/ret_by_value_runme.js
new file mode 100644
index 000000000..d9a77a20b
--- /dev/null
+++ b/Examples/test-suite/javascript/ret_by_value_runme.js
@@ -0,0 +1,8 @@
+var ret_by_value = require("./ret_by_value");
+
+a = ret_by_value.get_test();
+if (a.myInt != 100)
+ throw "RuntimeError";
+
+if (a.myShort != 200)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/setup_test.sh b/Examples/test-suite/javascript/setup_test.sh
new file mode 100644
index 000000000..913a74c4b
--- /dev/null
+++ b/Examples/test-suite/javascript/setup_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ ! -d $1 ]; then
+ mkdir $1;
+fi
+sed -e "s/\$testcase/$1/" -e "s/\$cflags/$2/" < node_template/binding.gyp.in > $1/binding.gyp
+sed s/\$testcase/$1/ node_template/index.js.in > $1/index.js
diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js
new file mode 100644
index 000000000..dbdd4136d
--- /dev/null
+++ b/Examples/test-suite/javascript/string_simple_runme.js
@@ -0,0 +1,10 @@
+var string_simple = require("./string_simple");
+
+// Test unicode string
+var str = "olé";
+
+var copy = string_simple.copy_string(str);
+
+if (str !== copy) {
+ throw "Error: copy is not equal: original="+str+", copy="+copy;
+}
diff --git a/Examples/test-suite/javascript/struct_value_runme.js b/Examples/test-suite/javascript/struct_value_runme.js
new file mode 100644
index 000000000..d6b26f726
--- /dev/null
+++ b/Examples/test-suite/javascript/struct_value_runme.js
@@ -0,0 +1,11 @@
+var struct_value = require("./struct_value");
+
+b = new struct_value.Bar();
+
+b.a.x = 3;
+if (b.a.x != 3)
+throw "RuntimeError";
+
+b.b.x = 3;
+if (b.b.x != 3)
+throw "RuntimeError"
diff --git a/Examples/test-suite/javascript/template_static_runme.js b/Examples/test-suite/javascript/template_static_runme.js
new file mode 100644
index 000000000..477d97249
--- /dev/null
+++ b/Examples/test-suite/javascript/template_static_runme.js
@@ -0,0 +1,3 @@
+var template_static = require("./template_static");
+
+template_static.Foo.bar_double(1);
diff --git a/Examples/test-suite/javascript/typedef_class_runme.js b/Examples/test-suite/javascript/typedef_class_runme.js
new file mode 100644
index 000000000..3e4dc9093
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_class_runme.js
@@ -0,0 +1,7 @@
+var typedef_class = require("./typedef_class");
+
+a = new typedef_class.RealA();
+a.a = 3;
+
+b = new typedef_class.B();
+b.testA(a);
diff --git a/Examples/test-suite/javascript/typedef_inherit_runme.js b/Examples/test-suite/javascript/typedef_inherit_runme.js
new file mode 100644
index 000000000..4abcc2536
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_inherit_runme.js
@@ -0,0 +1,23 @@
+var typedef_inherit = require("./typedef_inherit");
+
+a = new typedef_inherit.Foo();
+b = new typedef_inherit.Bar();
+
+x = typedef_inherit.do_blah(a);
+if (x != "Foo::blah")
+ print("Whoa! Bad return" + x);
+
+x = typedef_inherit.do_blah(b);
+if (x != "Bar::blah")
+ print("Whoa! Bad return" + x);
+
+c = new typedef_inherit.Spam();
+d = new typedef_inherit.Grok();
+
+x = typedef_inherit.do_blah2(c);
+if (x != "Spam::blah")
+ print("Whoa! Bad return" + x);
+
+x = typedef_inherit.do_blah2(d);
+if (x != "Grok::blah")
+ print ("Whoa! Bad return" + x);
diff --git a/Examples/test-suite/javascript/typedef_scope_runme.js b/Examples/test-suite/javascript/typedef_scope_runme.js
new file mode 100644
index 000000000..0ac56884c
--- /dev/null
+++ b/Examples/test-suite/javascript/typedef_scope_runme.js
@@ -0,0 +1,12 @@
+var typedef_scope = require("./typedef_scope");
+
+b = new typedef_scope.Bar();
+x = b.test1(42,"hello");
+if (x != 42)
+ print("Failed!!");
+
+x = b.test2(42,"hello");
+if (x != "hello")
+ print("Failed!!");
+
+
diff --git a/Examples/test-suite/javascript/typemap_arrays_runme.js b/Examples/test-suite/javascript/typemap_arrays_runme.js
new file mode 100644
index 000000000..cd6827ac9
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_arrays_runme.js
@@ -0,0 +1,5 @@
+var typemap_arrays = require("./typemap_arrays");
+
+if (typemap_arrays.sumA(null) != 60)
+ throw "RuntimeError, Sum is wrong";
+
diff --git a/Examples/test-suite/javascript/typemap_delete_runme.js b/Examples/test-suite/javascript/typemap_delete_runme.js
new file mode 100644
index 000000000..4b3174956
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_delete_runme.js
@@ -0,0 +1,5 @@
+var typemap_delete = require("./typemap_delete");
+
+r = new typemap_delete.Rect(123);
+if (r.val != 123)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/typemap_namespace_runme.js b/Examples/test-suite/javascript/typemap_namespace_runme.js
new file mode 100644
index 000000000..614e0ffeb
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_namespace_runme.js
@@ -0,0 +1,7 @@
+var typemap_namespace = require("./typemap_namespace");
+
+if (typemap_namespace.test1("hello") != "hello")
+ throw "RuntimeError";
+
+if (typemap_namespace.test2("hello") != "hello")
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/typemap_ns_using_runme.js b/Examples/test-suite/javascript/typemap_ns_using_runme.js
new file mode 100644
index 000000000..9115c16ae
--- /dev/null
+++ b/Examples/test-suite/javascript/typemap_ns_using_runme.js
@@ -0,0 +1,4 @@
+var typemap_ns_using = require("./typemap_ns_using");
+
+if (typemap_ns_using.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using1_runme.js b/Examples/test-suite/javascript/using1_runme.js
new file mode 100644
index 000000000..a2e37fcb6
--- /dev/null
+++ b/Examples/test-suite/javascript/using1_runme.js
@@ -0,0 +1,4 @@
+var using1 = require("./using1");
+
+if (using1.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using2_runme.js b/Examples/test-suite/javascript/using2_runme.js
new file mode 100644
index 000000000..aa5e9b15f
--- /dev/null
+++ b/Examples/test-suite/javascript/using2_runme.js
@@ -0,0 +1,4 @@
+var using2 = require("./using2");
+
+if (using2.spam(37) != 37)
+ throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/varargs_runme.js b/Examples/test-suite/javascript/varargs_runme.js
new file mode 100644
index 000000000..69d761e63
--- /dev/null
+++ b/Examples/test-suite/javascript/varargs_runme.js
@@ -0,0 +1,44 @@
+var varargs = require("./varargs");
+
+if (varargs.test("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+var f = new varargs.Foo("Greetings")
+if (f.str != "Greetings") {
+ throw new Error("Failed");
+}
+
+if (f.test("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_def("Hello",1) != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_def("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello") != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello", 1) != "Hello") {
+ throw new Error("Failed");
+}
+
+if (varargs.test_plenty("Hello", 1, 2) != "Hello") {
+ throw new Error("Failed");
+}
+
+var thrown = false;
+try {
+ varargs.test_plenty("Hello", 1, 2, 3);
+} catch (err) {
+ thrown = true;
+}
+if (!thrown) {
+ throw new Error("Failed");
+}
diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua
index 8a72f1bad..c7e0325c5 100644
--- a/Examples/test-suite/lua/cpp_basic_runme.lua
+++ b/Examples/test-suite/lua/cpp_basic_runme.lua
@@ -76,3 +76,13 @@ assert(cb.test_func_ptr(f,2)==-8)
-- Test that __tostring metamethod produce no internal asserts
f2_name = tostring(f2)
+
+f3 = cb.FooSub()
+f3_name = tostring(f3)
+
+f4 = cb.FooSubSub()
+f4_name = tostring(f4)
+
+assert( f2_name == "Foo" )
+assert( f3_name == "Foo" )
+assert( f4_name == "FooSubSub" )
diff --git a/Examples/test-suite/lua/operator_overload_runme.lua b/Examples/test-suite/lua/operator_overload_runme.lua
index 983daa1e5..5ba06ff08 100644
--- a/Examples/test-suite/lua/operator_overload_runme.lua
+++ b/Examples/test-suite/lua/operator_overload_runme.lua
@@ -78,6 +78,38 @@ assert(i(1,2)==6)
assert(tostring(Op(1))=="Op(1)")
assert(tostring(Op(-3))=="Op(-3)")
+
+-- check that operator overloads are correctly propogated down inheritance hierarchy
+
+a_d=OpDerived()
+b_d=OpDerived(5)
+c_d=OpDerived(5)
+d_d=OpDerived(2)
+-- test equality
+assert(a_d~=b_d)
+assert(b_d==c_d)
+assert(a_d~=d_d)
+
+-- test <
+assert(a_d<b_d)
+assert(a_d<=b_d)
+assert(b_d<=c_d)
+assert(b_d>=c_d)
+assert(b_d>d_d)
+assert(b_d>=d_d)
+--
+-- test + inheritance
+f_d=OpDerived(1)
+g_d=OpDerived(1)
+assert(f_d+g_d==Op(2))
+assert(f_d-g_d==Op(0))
+assert(f_d*g_d==Op(1))
+assert(f_d/g_d==Op(1))
+--
+-- plus add some code to check the __str__ fn inheritance
+assert(tostring(OpDerived(1))=="Op(1)")
+assert(tostring(OpDerived(-3))=="Op(-3)")
+
--[[
/* Sample test code in C++
diff --git a/Examples/test-suite/nspace.i b/Examples/test-suite/nspace.i
index 1520b3652..25e7104b2 100644
--- a/Examples/test-suite/nspace.i
+++ b/Examples/test-suite/nspace.i
@@ -2,7 +2,7 @@
%module nspace
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
#if defined(SWIGJAVA)
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
diff --git a/Examples/test-suite/nspace_extend.i b/Examples/test-suite/nspace_extend.i
index e92ff8c1d..2f7c6fbe1 100644
--- a/Examples/test-suite/nspace_extend.i
+++ b/Examples/test-suite/nspace_extend.i
@@ -2,7 +2,7 @@
%module nspace_extend
// nspace feature only supported by these languages
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
#if defined(SWIGJAVA)
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
diff --git a/Examples/test-suite/operator_overload.i b/Examples/test-suite/operator_overload.i
index 006662109..061e7024c 100644
--- a/Examples/test-suite/operator_overload.i
+++ b/Examples/test-suite/operator_overload.i
@@ -230,10 +230,10 @@ __rshift__,__lshift__ >>,<<
__getitem__,__setitem__ for operator[]
-Operators overloaded without C++ equivilents
+Operators overloaded without C++ equivalents
__pow__ for power operator
__str__ converts object to a string (should return a const char*)
-__concat__ for contatenation (if language supports)
+__concat__ for concatenation (if language supports)
*/
diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php
index 23490e61e..ae17d05e7 100644
--- a/Examples/test-suite/php/arrays_runme.php
+++ b/Examples/test-suite/php/arrays_runme.php
@@ -12,6 +12,7 @@ check::classname(simplestruct,$ss);
$as=new arraystruct();
$as->array_c="abc";
check::equal($as->array_c,"a",'$as->array_c=="a"');
+check::equal(isset($as->array_const_i),TRUE,'isset($as->array_const_i)');
check::done();
?>
diff --git a/Examples/test-suite/string_simple.i b/Examples/test-suite/string_simple.i
new file mode 100644
index 000000000..c319aa1ef
--- /dev/null
+++ b/Examples/test-suite/string_simple.i
@@ -0,0 +1,13 @@
+%module string_simple
+
+%newobject copy_string;
+
+%inline %{
+#include <string.h>
+const char* copy_string(const char* str) {
+ size_t len = strlen(str);
+ char* newstring = (char*) malloc(len + 1);
+ strcpy(newstring, str);
+ return newstring;
+}
+%}