Software /
code /
prosody
Comparison
tests/modulemanager_option_conversion.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 2152:871c847dcf77 |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
16 function test_value(value, returns) | 16 function test_value(value, returns) |
17 opt = value; | 17 opt = value; |
18 assert(module:get_option_number("opt") == returns.number, "number doesn't match"); | 18 assert(module:get_option_number("opt") == returns.number, "number doesn't match"); |
19 assert(module:get_option_string("opt") == returns.string, "string doesn't match"); | 19 assert(module:get_option_string("opt") == returns.string, "string doesn't match"); |
20 assert(module:get_option_boolean("opt") == returns.boolean, "boolean doesn't match"); | 20 assert(module:get_option_boolean("opt") == returns.boolean, "boolean doesn't match"); |
21 | 21 |
22 if type(returns.array) == "table" then | 22 if type(returns.array) == "table" then |
23 local target_array, returned_array = returns.array, module:get_option_array("opt"); | 23 local target_array, returned_array = returns.array, module:get_option_array("opt"); |
24 assert(#target_array == #returned_array, "array length doesn't match"); | 24 assert(#target_array == #returned_array, "array length doesn't match"); |
25 for i=1,#target_array do | 25 for i=1,#target_array do |
26 assert(target_array[i] == returned_array[i], "array item doesn't match"); | 26 assert(target_array[i] == returned_array[i], "array item doesn't match"); |
27 end | 27 end |
28 else | 28 else |
29 assert(module:get_option_array("opt") == returns.array, "array is returned (not nil)"); | 29 assert(module:get_option_array("opt") == returns.array, "array is returned (not nil)"); |
30 end | 30 end |
31 | 31 |
32 if type(returns.set) == "table" then | 32 if type(returns.set) == "table" then |
33 local target_items, returned_items = set.new(returns.set), module:get_option_set("opt"); | 33 local target_items, returned_items = set.new(returns.set), module:get_option_set("opt"); |
34 assert(target_items == returned_items, "set doesn't match"); | 34 assert(target_items == returned_items, "set doesn't match"); |
35 else | 35 else |
36 assert(module:get_option_set("opt") == returns.set, "set is returned (not nil)"); | 36 assert(module:get_option_set("opt") == returns.set, "set is returned (not nil)"); |