summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/typed_data_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/optional/capi/typed_data_spec.rb')
-rw-r--r--spec/ruby/optional/capi/typed_data_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/typed_data_spec.rb b/spec/ruby/optional/capi/typed_data_spec.rb
index 9ccfa562d1..6d1398a1a0 100644
--- a/spec/ruby/optional/capi/typed_data_spec.rb
+++ b/spec/ruby/optional/capi/typed_data_spec.rb
@@ -58,6 +58,17 @@ describe "CApiWrappedTypedStruct" do
end
end
+ describe "rb_check_type" do
+ it "raises an exception when checking typed data objects" do
+ -> {
+ a = @s.typed_wrap_struct(1024)
+ @s.rb_check_type(a, a)
+ }.should raise_error(TypeError) { |e|
+ e.message.should == 'wrong argument type Object (expected Data)'
+ }
+ end
+ end
+
describe "rb_check_typeddata" do
it "returns data pointer when the struct has the given type" do
a = @s.typed_wrap_struct(1024)
@@ -74,4 +85,16 @@ describe "CApiWrappedTypedStruct" do
-> { @s.rb_check_typeddata_different_type(a) }.should raise_error(TypeError)
end
end
+
+ describe "RTYPEDDATA_P" do
+ it "returns true for a typed data" do
+ a = @s.typed_wrap_struct(1024)
+ @s.RTYPEDDATA_P(a).should == true
+ end
+
+ it "returns false for an untyped data object" do
+ a = @s.untyped_wrap_struct(1024)
+ @s.RTYPEDDATA_P(a).should == false
+ end
+ end
end