lunarmodules / luassert

Assertion library for Lua
MIT License
202 stars 77 forks source link

Some thing lile assert.array(a).inlcude(element) #131

Closed xpol closed 7 years ago

xpol commented 9 years ago

Is it possible to have array include test like follow?

assert.array(a).has(element)
assert.array(a).inlcude(element)
assert.array(a).has_element(element)

Currently I have to write a function include()

local function include(t, element)
  for _, v in ipairs(t) do
    if v == element then
      return true
    end
  end
  return false
end

-- Then:
-- ...
    assert.is_true(include(all, agent1))
Tieske commented 7 years ago

see #145 for an example