summaryrefslogtreecommitdiff
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
parentdc48039197e7c315c596dedefca0a0486fd896c3 (diff)
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 9c18be5..5086fe6 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,
115 const char */*fmt*/, void */*data*/, 115 const char */*fmt*/, void */*data*/,
116 va_list args) 116 va_list args)
117{ 117{
118 using std::string;
119
118 static int index = 0; 120 static int index = 0;
119 121
120 const char *msg = va_arg(args, const char*); 122 const char *msg = va_arg(args, const char*);
121 123
122 std::string domains[] = {"", "", "", "mydomain", "mydomain2"}; 124 string domains[] = {"", "", "", "mydomain", "mydomain2"};
123 int levels[] = {EINA_LOG_LEVEL_DBG, EINA_LOG_LEVEL_CRITICAL, 125 int levels[] = {EINA_LOG_LEVEL_DBG, EINA_LOG_LEVEL_CRITICAL,
124 EINA_LOG_LEVEL_WARN, EINA_LOG_LEVEL_INFO, 126 EINA_LOG_LEVEL_WARN, EINA_LOG_LEVEL_INFO,
125 EINA_LOG_LEVEL_ERR}; 127 EINA_LOG_LEVEL_ERR};
126 std::string functions[] = {"f1", "", "f2", "f3", ""}; 128 string functions[] = {"f1", "", "f2", "f3", ""};
129#ifdef HAVE_NODEJS
130 int lines[] = {191, 192, 193, 194, 200};
131#else
127 int lines[] = {190, 191, 192, 193, 199}; 132 int lines[] = {190, 191, 192, 193, 199};
128 std::string messages[] = {"I changed again", "Cool to Hate", 133#endif
129 "One Fine Day", "Never Gonna Find Me", 134 string messages[] = {"I changed again", "Cool to Hate", "One Fine Day",
130 "The Kids Aren't Alright"}; 135 "Never Gonna Find Me", "The Kids Aren't Alright"};
131 136
132 assert(std::string(d->name, d->namelen) == domains[index]); 137 assert(string(d->name, d->namelen) == domains[index]);
133 assert(level == levels[index]); 138 assert(level == levels[index]);
134 assert(file == std::string("eina_js_suite.js")); 139 {
140 auto last_component = strrchr(file, '/');
141 assert(last_component);
142 assert(last_component == string("/eina_js_suite.js"));
143 }
135 assert(fnc == functions[index]); 144 assert(fnc == functions[index]);
136 assert(line == lines[index]); 145 assert(line == lines[index]);
137 assert(msg == messages[index]); 146 assert(msg == messages[index]);
@@ -377,7 +386,7 @@ int main(int, char*[])
377 // Enter the execution environment before evaluating any code. 386 // Enter the execution environment before evaluating any code.
378 v8::Context::Scope context_scope(context); 387 v8::Context::Scope context_scope(context);
379 v8::Local<v8::String> name(efl::eina::js::compatibility_new<v8::String> 388 v8::Local<v8::String> name(efl::eina::js::compatibility_new<v8::String>
380 (nullptr, "eina_js_suite.js")); 389 (nullptr, TESTS_SRC_DIR "/eina_js_suite.js"));
381 v8::Local<v8::Object> global = context->Global(); 390 v8::Local<v8::Object> global = context->Global();
382 v8::Handle<v8::Object> console = efl::eina::js::compatibility_new<v8::Object>(isolate); 391 v8::Handle<v8::Object> console = efl::eina::js::compatibility_new<v8::Object>(isolate);
383 global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "console"), console); 392 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 1c73bf5..2876195 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) {
227 assert(domain === 'mydomain', '#10'); 227 assert(domain === 'mydomain', '#10');
228 assert(color === '', '#11'); 228 assert(color === '', '#11');
229 assert(level === suite.LOG_LEVEL_WARN, '#12'); 229 assert(level === suite.LOG_LEVEL_WARN, '#12');
230 assert(file === 'eina_js_suite.js', '#13'); 230 assert(function(){ var components = file.split('/'); return components[components.length - 1]; }() === 'eina_js_suite.js', '#13');
231 assert(func === 'f4', '#14'); 231 assert(func === 'f4', '#14');
232 assert(line === 236, '#15'); 232 assert(line === ((typeof process !== 'undefined') ? 237 : 236), '#15');
233 assert(msg === 'What Happened To You', '#16'); 233 assert(msg === 'What Happened To You', '#16');
234 entered = true; 234 entered = true;
235}); 235});