efl

Форк
0
/
ethumb_js_suite.js 
93 строки · 2.2 Кб
1
#!/usr/bin/env node
2

3
// Preamble
4
function assert(condition, message) {
5
  if (!condition) {
6
      print("Assertion failed ", message);
7
      throw new Error(message || "Assertion failed");
8
  }
9
}
10

11
if(typeof process !== 'undefined')
12
{
13
    console.log('running from nodejs');
14
    console.log('path', process.env.NODE_PATH);
15
    console.log("teste1");
16

17
    efl = require('efl');
18
    assert(efl != null, "could not load efl node module");
19

20
    // Setup output aliases
21
    print = console.log;
22
    print_error = function() {
23
        if (process.argv.indexOf("--supress-errors") == -1)
24
            console.error.apply(null, arguments);
25
    };
26
    print_info = function() {
27
        if (process.argv.indexOf("--verbose") != -1)
28
            console.info.apply(null, arguments);
29
    };
30
    exit = efl.Ecore.Mainloop.quit;
31
}
32
else
33
{
34
    assert = function(test, message) { if (test !== true) throw message; };
35
    print('running from libv8')
36
    //FIXME Add levels to v8 tests
37
    print_error = print
38
    print_info = print
39
    exit = function() {}
40
}
41

42
// Global flag for suite success //
43
suite_success = true;
44
// Global test summary
45
suite_ok = 0;
46
suite_fail = []; // Will store the name of the failures
47

48
// Basic test function //
49
function start_test(test_name, test_func) {
50
  print("[ RUN         ]  Ethumb.js_suite: " + test_name);
51
  var test_result = true;
52
  try {
53
    test_func();
54
  } catch (e) {
55
    suite_success = false;
56
    test_result = false;
57
    print_error("Error: ", e, e.stack);
58
  }
59
  print("[        " + (test_result ? "PASS" : "FAIL") + " ]  Ethumb.js_suite: " + test_name);
60
  if (test_result)
61
    suite_ok += 1;
62
  else
63
    suite_fail.push(test_name);
64
}
65
// end Preamble
66

67
efl.Ethumb.initClient();
68

69
// Ethumb tests
70

71
start_test('dummy test', function () {
72
    assert(true);
73
});
74

75
efl.Ethumb.shutdownClient();
76

77
// footer
78

79
if (!suite_success) {
80
  print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
81
  print ("[ Total successful: %s ]", suite_ok);
82
  print ("[ Total failures: %s ]", suite_fail.length);
83
  print ("[ Tests failed: ]");
84
  for (var i = 0; i < suite_fail.length; i++) {
85
    print ("[    %s]", suite_fail[i]);
86
  };
87
  assert(false, "[ Test suite fail ]");
88
} else {
89
  print ("[ Test execution with success ]");
90
  print ("[ Total tests run: %s ]", suite_ok);
91
}
92

93
exit();
94

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.