mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-11-16 18:15:15 +00:00
31 lines
884 B
Lua
31 lines
884 B
Lua
dofile( 'tests/testlib.lua' )
|
|
|
|
cwriteln( '****************************************************************' )
|
|
cwriteln( ' Testing Utils Functions ' )
|
|
cwriteln( '****************************************************************' )
|
|
|
|
assert(isTableEqual(
|
|
lsyncd.splitQuotedString("-p 22 -i '/home/test/bla blu/id_rsa'"),
|
|
{"-p", "22", "-i", "/home/test/bla blu/id_rsa"}
|
|
))
|
|
|
|
-- test string replacement
|
|
local testData = {
|
|
localPort = 1234,
|
|
localHost = "localhorst"
|
|
}
|
|
|
|
assert(isTableEqual(
|
|
substitudeCommands({"-p^doesNotExist", "2^localHostA", "-i '^localPort'"}, testData),
|
|
{"-p^doesNotExist", "2localhorstA", "-i '1234'"}
|
|
))
|
|
|
|
assert(
|
|
substitudeCommands("-p^doesNotExist 2^localHostA -i '^localPort'", testData),
|
|
"-p^doesNotExist 2localhorstA -i '1234'"
|
|
)
|
|
|
|
|
|
assert(type(lsyncd.get_free_port()) == "number")
|
|
|
|
os.exit(0) |