summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-01-23 18:51:56 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-01-23 18:51:56 -0200
commit36c21bfb76f7621ec0406ca596b21f3576e65689 (patch)
treeb5e6d5acd820278f50bdf9afd71c8af0e0bee486
parent70a523e297103a18099ddddc09559d5732795de4 (diff)
downloadefl-36c21bfb76f7621ec0406ca596b21f3576e65689.tar.gz
eina-js: Fixed running eina_js_suite.js test with compilation in-source
When compilation is done in source, require('eina_js_suite') finds eina_js_suite.js instead of eina_js_suite.node. Renamed module to avoid clashes
-rw-r--r--src/Makefile_Eina_Js.am8
-rw-r--r--src/tests/eina_js/eina_js_suite.cc6
-rwxr-xr-xsrc/tests/eina_js/eina_js_suite.js5
3 files changed, 11 insertions, 8 deletions
diff --git a/src/Makefile_Eina_Js.am b/src/Makefile_Eina_Js.am
index 67ac630f8f..0700bc9f1d 100644
--- a/src/Makefile_Eina_Js.am
+++ b/src/Makefile_Eina_Js.am
@@ -56,13 +56,13 @@ bindings/eina_js/eina_js_value.hh
if EFL_ENABLE_TESTS
if HAVE_NODEJS
-AM_TESTS_ENVIRONMENT = EINA_SUITE_PATH='$(abs_builddir)/tests/eina_js/eina_js_suite'; export EINA_SUITE_PATH;
+AM_TESTS_ENVIRONMENT = NODE_PATH='$(abs_builddir)/tests/eina_js'; export NODE_PATH;
TESTS += tests/eina_js/eina_js_suite.js
lib_LTLIBRARIES += tests/eina_js/libeina_js_suite.la
-tests/eina_js/eina_js_suite.js: $(top_builddir)/src/tests/eina_js/eina_js_suite.node
+tests/eina_js/eina_js_suite.js: tests/eina_js/eina_js_suite_mod.node
AM_V_CP = $(am__v_CP_@AM_V@)
am__v_CP_ = $(am__v_CP_@AM_DEFAULT_V@)
@@ -70,8 +70,8 @@ am__v_CP_0 = @echo " CP " $@;
CP = cp
-$(top_builddir)/src/tests/eina_js/eina_js_suite.node: $(top_builddir)/src/tests/eina_js/libeina_js_suite.la
- $(AM_V_CP)$(CP) $(top_builddir)/src/tests/eina_js/.libs/libeina_js_suite.so $(top_builddir)/src/tests/eina_js/eina_js_suite.node
+tests/eina_js/eina_js_suite_mod.node: $(top_builddir)/src/tests/eina_js/libeina_js_suite.la
+ $(AM_V_CP)$(CP) $(top_builddir)/src/tests/eina_js/.libs/libeina_js_suite.so $(top_builddir)/src/tests/eina_js/eina_js_suite_mod.node
tests_eina_js_libeina_js_suite_la_SOURCES = \
tests/eina_js/eina_js_suite.cc
diff --git a/src/tests/eina_js/eina_js_suite.cc b/src/tests/eina_js/eina_js_suite.cc
index 306fe066d2..ff7e067b7d 100644
--- a/src/tests/eina_js/eina_js_suite.cc
+++ b/src/tests/eina_js/eina_js_suite.cc
@@ -243,10 +243,12 @@ int main(int, char*[])
namespace {
-void init(v8::Handle<v8::Object> exports)
+void eina_js_module_init(v8::Handle<v8::Object> exports)
{
+ fprintf(stderr, "teste\n"); fflush(stderr);
try
{
+
eina_init();
eo_init();
@@ -263,6 +265,6 @@ void init(v8::Handle<v8::Object> exports)
}
-NODE_MODULE(eina_js_suite, init)
+NODE_MODULE(eina_js_suite_mod, ::eina_js_module_init)
#endif
diff --git a/src/tests/eina_js/eina_js_suite.js b/src/tests/eina_js/eina_js_suite.js
index 9661ca3e14..d43b1c77b2 100755
--- a/src/tests/eina_js/eina_js_suite.js
+++ b/src/tests/eina_js/eina_js_suite.js
@@ -6,11 +6,12 @@ var assert;
if(typeof process !== 'undefined')
{
console.log('running from nodejs');
- console.log('path ', process.env.EINA_SUITE_PATH);
+ console.log('path', process.env.NODE_PATH);
console.log("teste1");
- suite = require(process.env.EINA_SUITE_PATH);
+ suite = require('eina_js_suite_mod');
assert = require('assert');
+ assert(suite != null);
}
else
{