/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/lua/argcargvtest_runme.lua
32 строки
1 KB
Erez Geva
Remove Lua 5.0 and Lua 5.1 and Lua options
30 май 2026, 19:24
30 май 2026, 19:24
74ff929
Код
Авторство
О чём код?
v=require("argcargvtest") catch_undef_globs() -- catch "undefined" global variables largs = {"hi", "hola", "hello"} assert(v.mainc(largs) == 3, "bad main typemap") targs = {"hi", "hola"} assert(v.mainv(targs, 0) == "hi", "bad main typemap") assert(v.mainv(targs, 1) == "hola", "bad main typemap") assert(v.mainv(targs, 2) == "<<NULL>>", "bad main typemap") errorVal = 0 function try() mainv("hello", 1) errorVal = 1 end assert(not pcall(try) and errorVal == 0, "bad main typemap") v.initializeApp(largs) -- Check that an empty array works. empty_args = {} assert(v.mainc(empty_args) == 0, "bad main typemap") assert(v.mainv(empty_args, 0) == "<<NULL>>", "bad main typemap") -- Check that empty strings are handled. empty_string = {"hello", "", "world"} assert(v.mainc(empty_string) == 3, "bad main typemap") assert(v.mainv(empty_string, 0) == "hello", "bad main typemap") assert(v.mainv(empty_string, 1) == "", "bad main typemap") assert(v.mainv(empty_string, 2) == "world", "bad main typemap") assert(v.mainv(empty_string, 3) == "<<NULL>>", "bad main typemap")