aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinícius dos Santos Oliveira <vini.ipsmaker@expertisesolutions.com.br>2015-06-12 17:52:36 -0300
committerVinícius dos Santos Oliveira <vini.ipsmaker@expertisesolutions.com.br>2015-06-12 17:52:36 -0300
commitf6a72df9d0bb1d7a79f366175d37fb04bc1be24b (patch)
tree9e7d7fbdfba89fd2e9fa3d63774192bbb32ebf0a
parenteina-js: Compatibilization of Eina JS log (diff)
downloadefl-f6a72df9d0bb1d7a79f366175d37fb04bc1be24b.tar.gz
eina_js: update log tests
-rw-r--r--src/tests/eina_js/eina_js_suite.cc25
-rw-r--r--src/tests/eina_js/eina_js_suite.js4
2 files changed, 19 insertions, 10 deletions
diff --git a/src/tests/eina_js/eina_js_suite.cc b/src/tests/eina_js/eina_js_suite.cc
index 9c18be545a..5086fe677d 100644
--- a/src/tests/eina_js/eina_js_suite.cc
+++ b/src/tests/eina_js/eina_js_suite.cc
@@ -115,23 +115,32 @@ static void eina_log_print_cb_js_test(const Eina_Log_Domain *d,
const char */*fmt*/, void */*data*/,
va_list args)
{
+ using std::string;
+
static int index = 0;
const char *msg = va_arg(args, const char*);
- std::string domains[] = {"", "", "", "mydomain", "mydomain2"};
+ string domains[] = {"", "", "", "mydomain", "mydomain2"};
int levels[] = {EINA_LOG_LEVEL_DBG, EINA_LOG_LEVEL_CRITICAL,
EINA_LOG_LEVEL_WARN, EINA_LOG_LEVEL_INFO,
EINA_LOG_LEVEL_ERR};
- std::string functions[] = {"f1", "", "f2", "f3", ""};
+ string functions[] = {"f1", "", "f2", "f3", ""};
+#ifdef HAVE_NODEJS
+ int lines[] = {191, 192, 193, 194, 200};
+#else
int lines[] = {190, 191, 192, 193, 199};
- std::string messages[] = {"I changed again", "Cool to Hate",
- "One Fine Day", "Never Gonna Find Me",
- "The Kids Aren't Alright"};
+#endif
+ string messages[] = {"I changed again", "Cool to Hate", "One Fine Day",
+ "Never Gonna Find Me", "The Kids Aren't Alright"};
- assert(std::string(d->name, d->namelen) == domains[index]);
+ assert(string(d->name, d->namelen) == domains[index]);
assert(level == levels[index]);
- assert(file == std::string("eina_js_suite.js"));
+ {
+ auto last_component = strrchr(file, '/');
+ assert(last_component);
+ assert(last_component == string("/eina_js_suite.js"));
+ }
assert(fnc == functions[index]);
assert(line == lines[index]);
assert(msg == messages[index]);
@@ -377,7 +386,7 @@ int main(int, char*[])
// Enter the execution environment before evaluating any code.
v8::Context::Scope context_scope(context);
v8::Local<v8::String> name(efl::eina::js::compatibility_new<v8::String>
- (nullptr, "eina_js_suite.js"));
+ (nullptr, TESTS_SRC_DIR "/eina_js_suite.js"));
v8::Local<v8::Object> global = context->Global();
v8::Handle<v8::Object> console = efl::eina::js::compatibility_new<v8::Object>(isolate);
global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "console"), console);
diff --git a/src/tests/eina_js/eina_js_suite.js b/src/tests/eina_js/eina_js_suite.js
index 1c73bf52f4..28761959b9 100644
--- a/src/tests/eina_js/eina_js_suite.js
+++ b/src/tests/eina_js/eina_js_suite.js
@@ -227,9 +227,9 @@ suite.log_print_cb_set(function(domain, color, level, file, func, line, msg) {
assert(domain === 'mydomain', '#10');
assert(color === '', '#11');
assert(level === suite.LOG_LEVEL_WARN, '#12');
- assert(file === 'eina_js_suite.js', '#13');
+ assert(function(){ var components = file.split('/'); return components[components.length - 1]; }() === 'eina_js_suite.js', '#13');
assert(func === 'f4', '#14');
- assert(line === 236, '#15');
+ assert(line === ((typeof process !== 'undefined') ? 237 : 236), '#15');
assert(msg === 'What Happened To You', '#16');
entered = true;
});