Updated MSpec source to 46e80081.
[rbx.git] / spec / subtend / exception_spec.rb
blob732363e52bd341e07ebd554515f22f24ebb6f6d5
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require File.dirname(__FILE__) + '/subtend_helper'
4 compile_extension('subtend_exception')
5 require File.dirname(__FILE__) + '/ext/subtend_exception'
7 describe "SubtendRaiser" do
8   before :each do
9     @s = SubtendRaiser.new
10   end
12   it "rb_raise should raise an exception" do
13     lambda { @s.raise! }.should raise_error(TypeError)
14   end
16   it "rb_raise terminates the function early" do
17     h = {}
18     lambda { @s.raise_early(h) }.should raise_error(TypeError)
19     h[:screwed].should == false
20   end
22   it "rb_exc_new should instantiate an exception with a string argument and return it" do
23     @s.rb_exc_new('foo').to_s.should == 'foo'
24   end
26   it "rb_exc_new2 should instantiate an exception with a string argument and return it" do
27     @s.rb_exc_new2('foo').to_s.should == 'foo'
28   end
30   it "rb_exc_new3 should instantiate an exception with a string argument and return it" do
31     @s.rb_exc_new3('foo').to_s.should == 'foo'
32   end
33 end