/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/javascript/global_functions_runme.js
69 строк
1 KB
Momtchil Momtchev
add more JS run tests
26 май 2023, 17:50
26 май 2023, 17:50
3baa5c0
Код
Авторство
О чём код?
var global_functions = require("global_functions"); function check(a, b) { if (a != b) { throw new Error("Failed: " + str(a) + " != " + str(b)); } } global_functions.global_void(); check(global_functions.global_one(1), 1); check(global_functions.global_two(2, 2), 4); fail = true; try { global_functions.global_void(1); } catch (e) { if (e instanceof TypeError) fail = false; } fail = false; if (fail) { throw new Error("argument count check failed"); } fail = true; try { global_functions.global_one(); } catch (e) { if (e instanceof TypeError) fail = false; } fail = false; if (fail) { throw new Error("argument count check failed"); } fail = true; try { global_functions.global_one(2, 2); } catch (e) { if (e instanceof TypeError) fail = false; } fail = false; if (fail) { throw new Error("argument count check failed"); } fail = true; try { global_functions.global_two(1); } catch (e) { if (e instanceof TypeError) fail = false; } fail = false; if (fail) { throw new Error("argument count check failed"); } fail = true; try { global_functions.global_two(3, 3, 3); } catch (e) { if (e instanceof TypeError) fail = false; } fail = false; if (fail) { throw new Error("argument count check failed"); }