Comparison

tests/test_util_multitable.lua @ 5776:bd0ff8ae98a8

Remove all trailing whitespace
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 09 Aug 2013 17:48:21 +0200
parent 3540:bc139431830b
child 7472:8965ad0aed2c
comparison
equal deleted inserted replaced
5775:a6c2b8933507 5776:bd0ff8ae98a8
1 -- Prosody IM 1 -- Prosody IM
2 -- Copyright (C) 2008-2010 Matthew Wild 2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain 3 -- Copyright (C) 2008-2010 Waqas Hussain
4 -- 4 --
5 -- This project is MIT/X11 licensed. Please see the 5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information. 6 -- COPYING file in the source package for more information.
7 -- 7 --
8 8
9 9
39 local function assert_has_all(message, list, ...) 39 local function assert_has_all(message, list, ...)
40 return assert_equal(select(2, has_items(list, ...)), "has-all", message or "List has all expected items, and no more", 2); 40 return assert_equal(select(2, has_items(list, ...)), "has-all", message or "List has all expected items, and no more", 2);
41 end 41 end
42 42
43 mt = multitable.new(); 43 mt = multitable.new();
44 44
45 local trigger1, trigger2, trigger3 = {}, {}, {}; 45 local trigger1, trigger2, trigger3 = {}, {}, {};
46 local item1, item2, item3 = {}, {}, {}; 46 local item1, item2, item3 = {}, {}, {};
47 47
48 assert_has_all("Has no items with trigger1", mt:get(trigger1)); 48 assert_has_all("Has no items with trigger1", mt:get(trigger1));
49 49
50 50
51 mt:add(1, 2, 3, item1); 51 mt:add(1, 2, 3, item1);
52 52
53 assert_has_all("Has item1 for 1, 2, 3", mt:get(1, 2, 3), item1); 53 assert_has_all("Has item1 for 1, 2, 3", mt:get(1, 2, 3), item1);
54 54
55 -- Doesn't support nil 55 -- Doesn't support nil
56 --[[ mt:add(nil, item1); 56 --[[ mt:add(nil, item1);
57 mt:add(nil, item2); 57 mt:add(nil, item2);
58 mt:add(nil, item3); 58 mt:add(nil, item3);
59 59
60 assert_has_all("Has all items with (nil)", mt:get(nil), item1, item2, item3); 60 assert_has_all("Has all items with (nil)", mt:get(nil), item1, item2, item3);
61 ]] 61 ]]
62 end 62 end