Skip to content
Snippets Groups Projects
Verified Commit abb562ea authored by Tomas Krizek's avatar Tomas Krizek
Browse files

config.basic: test coverage for parse_rdata()

parent 8963ad4c
No related branches found
No related tags found
1 merge request!1233lua: add parse_rdata() utility function
......@@ -31,6 +31,15 @@ local function test_globals()
same(table_print({fakepizza=1}), "{\n ['fakepizza'] = 1,\n}", 'table print works on tables')
end
-- test global API functions
local function test_global_functions()
boom(kres.parse_rdata, {'A 127.0.0.1'}, 'parse_rdata with non-table argument')
boom(kres.parse_rdata, {{1}}, 'parse_rdata with non-string data in arg table')
same(kres.parse_rdata({'A 127.0.0.1'}), {string.char(127, 0, 0, 1)}, 'parse_rdata with single record')
same(kres.parse_rdata({'A 127.0.0.1', 'A 127.0.0.2'}),
{string.char(127, 0, 0, 1), string.char(127, 0, 0, 2)}, 'parse_rdata with multiple records')
end
-- test if dns library functions work
local function test_rrset_functions()
local rr = {owner = '\3com\0', ttl = 1, type = kres.type.TXT, rdata = '\5hello'}
......@@ -195,6 +204,7 @@ end
return {
test_constants,
test_globals,
test_global_functions,
test_rrset_functions,
test_packet_functions,
test_json_functions,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment