Browse Source

[Test] Add some more tests for maps in selectors

tags/2.0
Vsevolod Stakhov 4 years ago
parent
commit
30cbcd0809
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      test/lua/unit/selectors.lua

+ 13
- 0
test/lua/unit/selectors.lua View File

@@ -13,6 +13,7 @@ context("Selectors test", function()
lua_selectors.maps.test_map = lua_maps.map_add_from_ucl({
'key value',
'key1 value1',
'key3 value1',
}, 'hash', 'test selectors maps')

before(function()
@@ -254,6 +255,18 @@ context("Selectors test", function()
selector = "id('key').apply_map(test_map)",
expect = {'value'}
},
["map filter list"] = {
selector = "list('key', 'key1', 'key2').filter_map(test_map)",
expect = {{'key', 'key1'}}
},
["map apply list"] = {
selector = "list('key', 'key1', 'key2', 'key3').apply_map(test_map)",
expect = {{'value', 'value1', 'value1'}}
},
["map apply list uniq"] = {
selector = "list('key', 'key1', 'key2', 'key3').apply_map(test_map).uniq",
expect = {{'value1', 'value'}}
},
}

for case_name, case in pairs(cases) do

Loading…
Cancel
Save