Skip to content

Instantly share code, notes, and snippets.

@nrk
Created May 30, 2010 10:01
Show Gist options
  • Save nrk/418929 to your computer and use it in GitHub Desktop.
Save nrk/418929 to your computer and use it in GitHub Desktop.
require 'luarocks.require'
require 'telescope'
function raise_error() error("whoops") end
function do_not_raise_error() return true end
context("assert_error", function()
test("with error being raised", function()
assert_error(raise_error)
end)
test("with error not being raised", function()
assert_error(do_not_raise_error)
end)
test("does not break the entire test suite", function()
assert_error(raise_error)
end)
end)
^C------------------------------------------------------------------------
assert_error:
with error being raised [P]
with error not being raised [E]
does not break the entire test suite [P]
------------------------------------------------------------------------
3 tests 2 passed 3 assertions 0 failed 1 error 0 unassertive 0 pending
with error not being raised:
...e/.luarocks/rocks//telescope/scm-1/lua/telescope.lua:147: interrupted!
stack traceback:
...e/.luarocks/rocks//telescope/scm-1/lua/telescope.lua:374: in function 'invoke_test'
...e/.luarocks/rocks//telescope/scm-1/lua/telescope.lua:399: in function 'run'
...ome/adaniele/.luarocks/rocks/telescope/scm-1/bin/tsc:266: in main chunk
[C]: ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment