Sha256: 557ef695309a3faf2f035335c36bf28291c68e4985ccf0d78f73b1f5772caca8
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__)) describe GirFFI::Builder::Argument::Base do describe "#subtype_tag_or_class_name" do describe "for a simple type" do it "returns the string ':void'" do mock(subtype = Object.new).tag { :void } mock(subtype).pointer? { false } mock(info = Object.new).param_type(0) { subtype } builder = GirFFI::Builder::Argument::Base.new nil, 'foo', info, nil assert_equal ":void", builder.subtype_tag_or_class_name end end describe "for an array of simple type :foo" do it "returns the string ':foo'" do mock(subtype = Object.new).tag { :foo } mock(subtype).pointer? { false } mock(info = Object.new).param_type(0) { subtype } builder = GirFFI::Builder::Argument::Base.new nil, 'bar', info, nil assert_equal ":foo", builder.subtype_tag_or_class_name end end describe "for an array of interface class Foo::Bar" do it "returns the string '::Foo::Bar'" do mock(interface = Object.new).safe_namespace { "Foo" } mock(interface).name { "Bar" } mock(subtype = Object.new).tag { :interface } mock(subtype).interface { interface } mock(subtype).pointer? { false } mock(info = Object.new).param_type(0) { subtype } builder = GirFFI::Builder::Argument::Base.new nil, 'bar', info, nil assert_equal "::Foo::Bar", builder.subtype_tag_or_class_name end end describe "for an array of pointer to simple type :foo" do it "returns the string '[:pointer, :foo]'" do mock(subtype = Object.new).tag { :foo } mock(subtype).pointer? { true } mock(info = Object.new).param_type(0) { subtype } builder = GirFFI::Builder::Argument::Base.new nil, 'bar', info, nil assert_equal "[:pointer, :foo]", builder.subtype_tag_or_class_name end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.2.2 | test/unit/argument_builder_test.rb |
gir_ffi-0.2.1 | test/unit/argument_builder_test.rb |