Skip to content

Commit

Permalink
test/cases/0270-ensure.lua - - add test for ensure_fails_with_substri…
Browse files Browse the repository at this point in the history
…ng error object support
  • Loading branch information
isage committed Mar 26, 2019
1 parent 6742f8c commit 6b30b7d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/cases/0270-ensure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ local ordered_pairs
'ordered_pairs'
}

local create_error_object
= import 'lua-nucleo/error.lua'
{
'create_error_object'
}

--------------------------------------------------------------------------------

local test = make_suite("ensure", ensure_exports)
Expand Down Expand Up @@ -329,6 +335,17 @@ test:case "ensure_fails_with_substring-complains-on-regex-mismatch" (function()
)
end)

test:case "ensure_fails_with_substring-supports-error-object" (function()
local res, err = pcall(function()
ensure_fails_with_substring(
"inner msg",
function() error(create_error_object("Ipsum")) end,
"Ipsum"
)
end)
ensure("should not throw error", res)
end)

--------------------------------------------------------------------------------

test:tests_for "ensure_error"
Expand Down

0 comments on commit 6b30b7d

Please sign in to comment.