summaryrefslogtreecommitdiff
path: root/test/-ext-/typeddata/test_typeddata.rb
blob: c24ad08004bd464606b6f6a05bd608c5399b10d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'test/unit'
require "-test-/typeddata/typeddata"

class Test_TypedData < Test::Unit::TestCase
  def test_wrong_argtype
    assert_raise_with_message(TypeError, "wrong argument type false (expected typed_data)") {Bug::TypedData.check(false)}

    assert_raise_with_message(TypeError, "wrong argument type true (expected typed_data)") {Bug::TypedData.check(true)}

    assert_raise_with_message(TypeError, "wrong argument type Symbol (expected typed_data)") {Bug::TypedData.check(:e)}

    assert_raise_with_message(TypeError, "wrong argument type Fixnum (expected typed_data)") {Bug::TypedData.check(0)}

    assert_raise_with_message(TypeError, "wrong argument type String (expected typed_data)") {Bug::TypedData.check("a")}
  end
end