mirror of
https://github.com/tailix/libkernaux.git
synced 2025-03-31 17:25:22 -04:00
mruby: improve tests
This commit is contained in:
parent
ad428c3a30
commit
0f083849b1
2 changed files with 20 additions and 13 deletions
20
pkgs/mruby/test/assert.rb
Normal file
20
pkgs/mruby/test/assert.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
assert 'KernAux.assert_cb is set by default' do
|
||||
assert_equal KernAux::DEFAULT_ASSERT_CB, KernAux.assert_cb
|
||||
end
|
||||
|
||||
assert 'KernAux::DEFAULT_ASSERT_CB raises' do
|
||||
assert_raise KernAux::AssertError, 'foo.rb:123:bar' do
|
||||
KernAux::DEFAULT_ASSERT_CB.call 'foo.rb', 123, 'bar'
|
||||
end
|
||||
end
|
||||
|
||||
assert 'we can set KernAux.assert_cb' do
|
||||
KernAux.assert_cb = KernAux::DEFAULT_ASSERT_CB
|
||||
assert_equal KernAux::DEFAULT_ASSERT_CB, KernAux.assert_cb
|
||||
end
|
||||
|
||||
assert 'KernAux.assert_do raises' do
|
||||
assert_raise KernAux::AssertError, 'foo.rb:123:hello' do
|
||||
KernAux.assert_do 'foo.rb', 123, 'hello'
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
assert do
|
||||
assert_equal KernAux::DEFAULT_ASSERT_CB, KernAux.assert_cb
|
||||
|
||||
KernAux.assert_cb = 123
|
||||
assert_equal 123, KernAux.assert_cb
|
||||
|
||||
KernAux.assert_cb = KernAux::DEFAULT_ASSERT_CB
|
||||
assert_equal KernAux::DEFAULT_ASSERT_CB, KernAux.assert_cb
|
||||
|
||||
assert_raise KernAux::AssertError, 'foo.rb:123:hello' do
|
||||
KernAux.assert_do 'foo.rb', 123, 'hello'
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue