gir_ffi 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +14 -0
- data/TODO.rdoc +10 -5
- data/lib/ffi-glib.rb +7 -73
- data/lib/ffi-glib/array.rb +29 -4
- data/lib/ffi-glib/byte_array.rb +15 -1
- data/lib/ffi-glib/hash_table.rb +31 -24
- data/lib/ffi-glib/list.rb +28 -0
- data/lib/ffi-glib/list_methods.rb +10 -2
- data/lib/ffi-glib/ptr_array.rb +39 -0
- data/lib/ffi-glib/s_list.rb +29 -0
- data/lib/ffi-gobject.rb +49 -22
- data/lib/ffi-gobject/closure.rb +4 -3
- data/lib/ffi-gobject/helper.rb +20 -43
- data/lib/ffi-gobject/initially_unowned.rb +2 -0
- data/lib/ffi-gobject/object.rb +54 -0
- data/lib/ffi-gobject/ruby_closure.rb +22 -16
- data/lib/ffi-gobject/value.rb +54 -19
- data/lib/ffi-gobject_introspection/i_constant_info.rb +17 -1
- data/lib/ffi-gobject_introspection/i_field_info.rb +8 -0
- data/lib/ffi-gobject_introspection/i_property_info.rb +3 -1
- data/lib/ffi-gobject_introspection/lib.rb +19 -2
- data/lib/gir_ffi/arg_helper.rb +7 -45
- data/lib/gir_ffi/builder.rb +1 -1
- data/lib/gir_ffi/builder/argument.rb +148 -107
- data/lib/gir_ffi/builder/argument/base.rb +5 -5
- data/lib/gir_ffi/builder/argument/in_base.rb +2 -2
- data/lib/gir_ffi/builder/argument/in_out_base.rb +2 -3
- data/lib/gir_ffi/builder/argument/out_base.rb +2 -3
- data/lib/gir_ffi/builder/function.rb +11 -17
- data/lib/gir_ffi/builder/module.rb +26 -0
- data/lib/gir_ffi/builder/type.rb +5 -0
- data/lib/gir_ffi/builder/type/base.rb +2 -0
- data/lib/gir_ffi/builder/type/callback.rb +18 -3
- data/lib/gir_ffi/builder/type/constant.rb +4 -12
- data/lib/gir_ffi/builder/type/enum.rb +15 -6
- data/lib/gir_ffi/builder/type/interface.rb +4 -0
- data/lib/gir_ffi/builder/type/object.rb +11 -0
- data/lib/gir_ffi/builder/type/struct_based.rb +14 -4
- data/lib/gir_ffi/builder/type/union.rb +13 -7
- data/lib/gir_ffi/builder/type/with_layout.rb +59 -8
- data/lib/gir_ffi/class_base.rb +8 -1
- data/lib/gir_ffi/in_out_pointer.rb +17 -18
- data/lib/gir_ffi/in_pointer.rb +8 -1
- data/lib/gir_ffi/type_map.rb +12 -0
- data/lib/gir_ffi/variable_name_generator.rb +12 -0
- data/lib/gir_ffi/version.rb +1 -1
- data/test/ffi-glib/array_test.rb +54 -0
- data/test/ffi-glib/byte_array_test.rb +21 -0
- data/test/ffi-glib/glib_overrides_test.rb +1 -46
- data/test/ffi-glib/hash_table_test.rb +24 -0
- data/test/ffi-glib/list_test.rb +46 -0
- data/test/ffi-glib/ptr_array_test.rb +51 -0
- data/test/ffi-glib/s_list_test.rb +46 -0
- data/test/ffi-gobject/g_object_overrides_test.rb +8 -8
- data/test/ffi-gobject/gobject_test.rb +26 -0
- data/test/ffi-gobject/object_test.rb +12 -0
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +5 -1
- data/test/ffi-gobject_introspection/lib_test.rb +56 -0
- data/test/integration/generated_gimarshallingtests_test.rb +118 -76
- data/test/integration/generated_regress_test.rb +220 -62
- data/test/integration/pretty_print_test.rb +11 -0
- data/test/type_builder_test.rb +0 -48
- data/test/unintrospectable_type_builder_test.rb +8 -2
- data/test/unit/builder_test.rb +1 -1
- data/test/unit/callback_builder_test.rb +19 -0
- data/test/unit/constant_builder_test.rb +11 -0
- data/test/unit/enum_builder_test.rb +25 -0
- data/test/unit/function_builder_test.rb +17 -0
- data/test/unit/in_out_pointer_test.rb +11 -0
- data/test/unit/in_pointer_test.rb +6 -2
- data/test/unit/interface_builder_test.rb +17 -0
- data/test/unit/module_builder_test.rb +95 -0
- data/test/unit/object_type_builder_test.rb +24 -0
- data/test/unit/struct_builder_test.rb +106 -0
- data/test/unit/union_builder_test.rb +17 -0
- data/test/unit/variable_name_generator_test.rb +16 -0
- metadata +102 -75
- data/test/module_builder_test.rb +0 -53
@@ -36,8 +36,14 @@ describe GirFFI::Builder::Type::Unintrospectable do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "its #find_signal method" do
|
39
|
-
it "
|
40
|
-
|
39
|
+
it "raises correct error for a signal that doesn't exist" do
|
40
|
+
msg = nil
|
41
|
+
begin
|
42
|
+
@bldr.find_signal "foo"
|
43
|
+
rescue RuntimeError => e
|
44
|
+
msg = e.message
|
45
|
+
end
|
46
|
+
assert_match(/^Signal/, msg)
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
data/test/unit/builder_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
describe GirFFI::Builder do
|
4
|
-
describe "
|
4
|
+
describe "::itypeinfo_to_callback_ffitype" do
|
5
5
|
describe "for an :interface argument" do
|
6
6
|
setup do
|
7
7
|
@iface = Object.new
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Type::Callback do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns a statement assigning the callback to a constant" do
|
6
|
+
mock(info = Object.new).safe_name { "TheCallback" }
|
7
|
+
stub(info).namespace { "Foo" }
|
8
|
+
mock(GirFFI::Builder).ffi_function_return_type(info) { :ret_type }
|
9
|
+
mock(GirFFI::Builder).ffi_function_argument_types(info) { [ :baz, :qux ] }
|
10
|
+
|
11
|
+
builder = GirFFI::Builder::Type::Callback.new(info)
|
12
|
+
|
13
|
+
assert_equal "TheCallback = Lib.callback :TheCallback, [:baz, :qux], :ret_type",
|
14
|
+
builder.pretty_print
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
@@ -1,5 +1,16 @@
|
|
1
1
|
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
describe GirFFI::Builder::Type::Constant do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns the correct assignment statement" do
|
6
|
+
mock(info = Object.new).value { "bar" }
|
7
|
+
mock(info).safe_name { "FOO_CONSTANT" }
|
8
|
+
stub(info).namespace { "Foo" }
|
9
|
+
|
10
|
+
builder = GirFFI::Builder::Type::Constant.new(info)
|
11
|
+
|
12
|
+
assert_equal "FOO_CONSTANT = \"bar\"", builder.pretty_print
|
13
|
+
end
|
14
|
+
end
|
4
15
|
end
|
5
16
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Type::Enum do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns a statement assigning the enum to a constant" do
|
6
|
+
mock(info = Object.new).safe_name { "TheEnum" }
|
7
|
+
stub(info).namespace { "Foo" }
|
8
|
+
|
9
|
+
mock(val1 = Object.new).name { "value1" }
|
10
|
+
mock(val1).value { 1 }
|
11
|
+
mock(val2 = Object.new).name { "value2" }
|
12
|
+
mock(val2).value { 2 }
|
13
|
+
|
14
|
+
mock(info).values { [val1, val2] }
|
15
|
+
|
16
|
+
builder = GirFFI::Builder::Type::Enum.new(info)
|
17
|
+
|
18
|
+
assert_equal "TheEnum = Lib.enum :TheEnum, [:value1, 1, :value2, 2]",
|
19
|
+
builder.pretty_print
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Function do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "delegates to #generate" do
|
6
|
+
builder = GirFFI::Builder::Function.new(:info, :libmodule)
|
7
|
+
|
8
|
+
mock(builder).generate { 'result_from_generate' }
|
9
|
+
|
10
|
+
assert_equal "result_from_generate", builder.pretty_print
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
@@ -114,5 +114,16 @@ describe GirFFI::InOutPointer do
|
|
114
114
|
assert_equal "Some value", ptr.to_value
|
115
115
|
end
|
116
116
|
end
|
117
|
+
|
118
|
+
describe "for an array of :gint32" do
|
119
|
+
before do
|
120
|
+
@result = GirFFI::InOutPointer.from_array :gint32, [1, 2, 3]
|
121
|
+
end
|
122
|
+
|
123
|
+
it "returns an array of integers with the correct values" do
|
124
|
+
assert_equal [1, 2, 3], @result.to_sized_array_value(3)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
117
128
|
end
|
118
129
|
end
|
@@ -49,8 +49,7 @@ describe GirFFI::InPointer do
|
|
49
49
|
@result = GirFFI::InPointer.from :utf8, "foo"
|
50
50
|
end
|
51
51
|
|
52
|
-
it "returns
|
53
|
-
ary = @result.read_array_of_pointer(3)
|
52
|
+
it "returns a pointer to the given string" do
|
54
53
|
assert_equal "foo", @result.read_string
|
55
54
|
end
|
56
55
|
|
@@ -64,6 +63,11 @@ describe GirFFI::InPointer do
|
|
64
63
|
result = GirFFI::InPointer.from :foo, nil
|
65
64
|
assert_nil result
|
66
65
|
end
|
66
|
+
|
67
|
+
it "sets the pointer's address to the passed value for type :gint8" do
|
68
|
+
result = GirFFI::InPointer.from :gint8, 23
|
69
|
+
assert_equal 23, result.address
|
70
|
+
end
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Type::Interface do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns a module block, extending InterfaceBase" do
|
6
|
+
mock(info = Object.new).safe_name { "Bar" }
|
7
|
+
stub(info).namespace { "Foo" }
|
8
|
+
|
9
|
+
builder = GirFFI::Builder::Type::Interface.new(info)
|
10
|
+
|
11
|
+
assert_equal "module Bar\n extend InterfaceBase\nend", builder.pretty_print
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Module do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
describe "for a module with no members" do
|
6
|
+
it "returns just a module block" do
|
7
|
+
gir = GObjectIntrospection::IRepository.default
|
8
|
+
stub(gir).require("Foo", nil) { }
|
9
|
+
mock(gir).infos("Foo") { [] }
|
10
|
+
|
11
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
12
|
+
res = builder.pretty_print
|
13
|
+
expected = "module Foo\nend"
|
14
|
+
|
15
|
+
assert_equal expected, res
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "for a module with a function member" do
|
20
|
+
it "returns a module block with pretty printed function inside" do
|
21
|
+
stub(info = Object.new).info_type { :function }
|
22
|
+
mock(subbuilder = Object.new).pretty_print { "def foo\n function_body\nend" }
|
23
|
+
|
24
|
+
gir = GObjectIntrospection::IRepository.default
|
25
|
+
stub(gir).require("Foo", nil) { }
|
26
|
+
mock(gir).infos("Foo") { [info] }
|
27
|
+
|
28
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
29
|
+
stub(builder).libmodule { :bla }
|
30
|
+
mock(GirFFI::Builder::Function).new(info, :bla) { subbuilder }
|
31
|
+
|
32
|
+
res = builder.pretty_print
|
33
|
+
expected = "module Foo\n def foo\n function_body\n end\nend"
|
34
|
+
|
35
|
+
assert_equal expected, res
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#function_definition" do
|
41
|
+
it "delegates to GirFFI::Builder::Function#generate" do
|
42
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
43
|
+
|
44
|
+
mock(fb = Object.new).generate { "function body" }
|
45
|
+
mock(GirFFI::Builder::Function).new("info", "lib") { fb }
|
46
|
+
|
47
|
+
result = builder.send :function_definition, "info", "lib"
|
48
|
+
|
49
|
+
assert_equal "function body", result
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#sub_builder" do
|
54
|
+
describe "for a :function argument" do
|
55
|
+
it "creates a GirFFI::Builder::Function object" do
|
56
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
57
|
+
mock(builder).libmodule { Lib }
|
58
|
+
|
59
|
+
stub(info = Object.new).info_type { :function }
|
60
|
+
|
61
|
+
result = builder.send :sub_builder, info
|
62
|
+
assert_instance_of GirFFI::Builder::Function, result
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "for an :object argument" do
|
67
|
+
it "creates a GirFFI::Builder::Type::Object object" do
|
68
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
69
|
+
|
70
|
+
stub(info = Object.new).info_type { :object }
|
71
|
+
stub(info).namespace { "Foo" }
|
72
|
+
stub(info).safe_name { "FooClass" }
|
73
|
+
|
74
|
+
result = builder.send :sub_builder, info
|
75
|
+
assert_instance_of GirFFI::Builder::Type::Object, result
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#build_namespaced_class" do
|
81
|
+
it "raises a clear error if the named class does not exist" do
|
82
|
+
gir = GObjectIntrospection::IRepository.default
|
83
|
+
stub(gir).require("Foo", nil) { }
|
84
|
+
|
85
|
+
builder = GirFFI::Builder::Module.new "Foo"
|
86
|
+
|
87
|
+
mock(gir).find_by_name("Foo", "Bar") { nil }
|
88
|
+
|
89
|
+
assert_raises NameError do
|
90
|
+
builder.build_namespaced_class :Bar
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
@@ -17,4 +17,28 @@ describe GirFFI::Builder::Type::Object do
|
|
17
17
|
pass
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
describe "#find_property" do
|
22
|
+
it "finds a property specified on the class itself" do
|
23
|
+
builder = GirFFI::Builder::Type::Object.new(
|
24
|
+
get_introspection_data('Regress', 'TestObj'))
|
25
|
+
prop = builder.find_property("int")
|
26
|
+
assert_equal "int", prop.name
|
27
|
+
end
|
28
|
+
|
29
|
+
it "finds a property specified on the parent class" do
|
30
|
+
builder = GirFFI::Builder::Type::Object.new(
|
31
|
+
get_introspection_data('Regress', 'TestSubObj'))
|
32
|
+
prop = builder.find_property("int")
|
33
|
+
assert_equal "int", prop.name
|
34
|
+
end
|
35
|
+
|
36
|
+
it "raises an error if the property is not found" do
|
37
|
+
builder = GirFFI::Builder::Type::Object.new(
|
38
|
+
get_introspection_data('Regress', 'TestSubObj'))
|
39
|
+
assert_raises RuntimeError do
|
40
|
+
builder.find_property("this-property-does-not-exist")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
20
44
|
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Type::Struct do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns a class block" do
|
6
|
+
mock(info = Object.new).safe_name { "Bar" }
|
7
|
+
stub(info).namespace { "Foo" }
|
8
|
+
|
9
|
+
builder = GirFFI::Builder::Type::Struct.new(info)
|
10
|
+
|
11
|
+
assert_equal "class Bar\nend", builder.pretty_print
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "for a struct with a simple layout" do
|
16
|
+
before do
|
17
|
+
stub(@type = Object.new).pointer? { false }
|
18
|
+
stub(@type).tag { :gint32 }
|
19
|
+
|
20
|
+
stub(field = Object.new).field_type { @type }
|
21
|
+
stub(field).name { "bar" }
|
22
|
+
stub(field).offset { 0 }
|
23
|
+
stub(field).writable? { true }
|
24
|
+
|
25
|
+
stub(@struct = Object.new).safe_name { 'Bar' }
|
26
|
+
stub(@struct).namespace { 'Foo' }
|
27
|
+
stub(@struct).fields { [ field ] }
|
28
|
+
stub(@struct).find_method { }
|
29
|
+
|
30
|
+
@builder = GirFFI::Builder::Type::Struct.new @struct
|
31
|
+
end
|
32
|
+
|
33
|
+
it "creates the correct layout specification" do
|
34
|
+
spec = @builder.send :layout_specification
|
35
|
+
assert_equal [:bar, :int32, 0], spec
|
36
|
+
end
|
37
|
+
|
38
|
+
it "creates getter and setter methods" do
|
39
|
+
m = Module.new { module Lib; end }
|
40
|
+
stub(GirFFI::Builder).build_module('Foo') { m }
|
41
|
+
|
42
|
+
c = Class.new
|
43
|
+
|
44
|
+
refute c.method_defined?(:bar)
|
45
|
+
refute c.method_defined?(:bar=)
|
46
|
+
|
47
|
+
@builder.instance_eval { @klass = c }
|
48
|
+
@builder.send :setup_field_accessors
|
49
|
+
|
50
|
+
assert c.method_defined?(:bar)
|
51
|
+
assert c.method_defined?(:bar=)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "for a struct with a layout with a fixed-length array" do
|
56
|
+
before do
|
57
|
+
stub(subtype = Object.new).pointer? { false }
|
58
|
+
stub(subtype).tag { :foo }
|
59
|
+
|
60
|
+
stub(@type = Object.new).pointer? { false }
|
61
|
+
stub(@type).tag { :array }
|
62
|
+
stub(@type).array_fixed_size { 2 }
|
63
|
+
stub(@type).param_type { subtype }
|
64
|
+
|
65
|
+
stub(field = Object.new).field_type { @type }
|
66
|
+
stub(field).name { "bar" }
|
67
|
+
stub(field).offset { 0 }
|
68
|
+
|
69
|
+
stub(@struct = Object.new).safe_name { 'Bar' }
|
70
|
+
stub(@struct).namespace { 'Foo' }
|
71
|
+
stub(@struct).fields { [ field ] }
|
72
|
+
end
|
73
|
+
|
74
|
+
it "creates the correct ffi type for the array" do
|
75
|
+
builder = GirFFI::Builder::Type::Struct.new @struct
|
76
|
+
spec = builder.send :itypeinfo_to_ffitype_for_struct, @type
|
77
|
+
assert_equal [:foo, 2], spec
|
78
|
+
end
|
79
|
+
|
80
|
+
it "creates the correct layout specification" do
|
81
|
+
builder = GirFFI::Builder::Type::Struct.new @struct
|
82
|
+
spec = builder.send :layout_specification
|
83
|
+
assert_equal [:bar, [:foo, 2], 0], spec
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "for a struct without defined fields" do
|
88
|
+
it "uses a single field of the parent struct type as the default layout" do
|
89
|
+
@gir = GObjectIntrospection::IRepository.default
|
90
|
+
@gir.require 'GObject', nil
|
91
|
+
|
92
|
+
stub(info = Object.new).parent { @gir.find_by_name 'GObject', 'Object' }
|
93
|
+
stub(info).fields { [] }
|
94
|
+
stub(info).info_type { :object }
|
95
|
+
stub(info).safe_name { 'Bar' }
|
96
|
+
stub(info).namespace { 'Foo' }
|
97
|
+
|
98
|
+
@classbuilder = GirFFI::Builder::Type::Object.new info
|
99
|
+
|
100
|
+
spec = @classbuilder.send :layout_specification
|
101
|
+
assert_equal [:parent, GObject::Object::Struct, 0], spec
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe GirFFI::Builder::Type::Union do
|
4
|
+
describe "#pretty_print" do
|
5
|
+
it "returns a class block" do
|
6
|
+
mock(info = Object.new).safe_name { "Bar" }
|
7
|
+
stub(info).namespace { "Foo" }
|
8
|
+
|
9
|
+
builder = GirFFI::Builder::Type::Union.new(info)
|
10
|
+
|
11
|
+
assert_equal "class Bar\nend", builder.pretty_print
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'gir_ffi/variable_name_generator'
|
4
|
+
|
5
|
+
describe GirFFI::VariableNameGenerator do
|
6
|
+
describe "#new_var" do
|
7
|
+
it "generates a sequence of predictable variable names" do
|
8
|
+
gen = GirFFI::VariableNameGenerator.new
|
9
|
+
|
10
|
+
assert_equal "_v1", gen.new_var
|
11
|
+
assert_equal "_v2", gen.new_var
|
12
|
+
assert_equal "_v3", gen.new_var
|
13
|
+
assert_equal "_v4", gen.new_var
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,83 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Matijs van Zuijlen
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: ffi
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &13966040 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 7
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- 8
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 1.0.8
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: minitest
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *13966040
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: indentation
|
27
|
+
requirement: &13964120 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.0.6
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *13964120
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
requirement: &13975240 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 11
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 0
|
48
|
-
- 2
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
49
43
|
version: 2.0.2
|
50
44
|
type: :development
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rr
|
54
45
|
prerelease: false
|
55
|
-
|
46
|
+
version_requirements: *13975240
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rr
|
49
|
+
requirement: &13973360 !ruby/object:Gem::Requirement
|
56
50
|
none: false
|
57
|
-
requirements:
|
51
|
+
requirements:
|
58
52
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 19
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 0
|
64
|
-
- 2
|
53
|
+
- !ruby/object:Gem::Version
|
65
54
|
version: 1.0.2
|
66
55
|
type: :development
|
67
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *13973360
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &13987300 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.9.2
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *13987300
|
68
69
|
description:
|
69
|
-
email:
|
70
|
+
email:
|
70
71
|
- matijs@matijs.net
|
71
72
|
executables: []
|
72
|
-
|
73
73
|
extensions: []
|
74
|
-
|
75
|
-
extra_rdoc_files:
|
74
|
+
extra_rdoc_files:
|
76
75
|
- DESIGN.rdoc
|
77
76
|
- History.txt
|
78
77
|
- README.rdoc
|
79
78
|
- TODO.rdoc
|
80
|
-
files:
|
79
|
+
files:
|
81
80
|
- lib/ffi-gtk3.rb
|
82
81
|
- lib/gir_ffi.rb
|
83
82
|
- lib/ffi-gtk/base.rb
|
@@ -109,6 +108,7 @@ files:
|
|
109
108
|
- lib/ffi-glib.rb
|
110
109
|
- lib/ffi-gobject.rb
|
111
110
|
- lib/ffi-glib/array.rb
|
111
|
+
- lib/ffi-glib/ptr_array.rb
|
112
112
|
- lib/ffi-glib/list.rb
|
113
113
|
- lib/ffi-glib/list_methods.rb
|
114
114
|
- lib/ffi-glib/hash_table.rb
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/gir_ffi/class_base.rb
|
147
147
|
- lib/gir_ffi/callback_helper.rb
|
148
148
|
- lib/gir_ffi/in_pointer.rb
|
149
|
+
- lib/gir_ffi/variable_name_generator.rb
|
149
150
|
- lib/gir_ffi/version.rb
|
150
151
|
- lib/gir_ffi/allocation_helper.rb
|
151
152
|
- lib/gir_ffi/arg_helper.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- lib/ffi-gobject/closure.rb
|
156
157
|
- lib/ffi-gobject/initially_unowned.rb
|
157
158
|
- lib/ffi-gobject/helper.rb
|
159
|
+
- lib/ffi-gobject/object.rb
|
158
160
|
- test/unintrospectable_type_builder_test.rb
|
159
161
|
- test/function_definition_builder_test.rb
|
160
162
|
- test/gir_ffi_test_helper.rb
|
@@ -167,28 +169,44 @@ files:
|
|
167
169
|
- test/ffi-gobject_introspection/i_repository_test.rb
|
168
170
|
- test/ffi-gobject_introspection/i_object_info_test.rb
|
169
171
|
- test/ffi-gobject_introspection/i_base_info_test.rb
|
172
|
+
- test/ffi-gobject_introspection/lib_test.rb
|
170
173
|
- test/ffi-gobject_introspection/i_constant_info_test.rb
|
171
174
|
- test/test_helper.rb
|
172
175
|
- test/girffi_test.rb
|
173
176
|
- test/interface_type_builder_test.rb
|
174
|
-
- test/
|
177
|
+
- test/unit/union_builder_test.rb
|
178
|
+
- test/unit/callback_builder_test.rb
|
175
179
|
- test/unit/constant_builder_test.rb
|
180
|
+
- test/unit/function_builder_test.rb
|
181
|
+
- test/unit/module_builder_test.rb
|
182
|
+
- test/unit/interface_builder_test.rb
|
176
183
|
- test/unit/in_out_pointer_test.rb
|
177
184
|
- test/unit/callback_helper_test.rb
|
178
185
|
- test/unit/builder_test.rb
|
179
186
|
- test/unit/in_pointer_test.rb
|
187
|
+
- test/unit/enum_builder_test.rb
|
188
|
+
- test/unit/struct_builder_test.rb
|
180
189
|
- test/unit/object_type_builder_test.rb
|
190
|
+
- test/unit/variable_name_generator_test.rb
|
181
191
|
- test/type_builder_test.rb
|
182
192
|
- test/builder_test.rb
|
183
193
|
- test/gtk_overrides_test.rb
|
184
194
|
- test/integration/generated_regress_test.rb
|
195
|
+
- test/integration/pretty_print_test.rb
|
185
196
|
- test/integration/generated_gtk_test.rb
|
186
197
|
- test/integration/generated_gobject_test.rb
|
187
198
|
- test/integration/generated_gio_test.rb
|
188
199
|
- test/integration/generated_gimarshallingtests_test.rb
|
200
|
+
- test/ffi-glib/s_list_test.rb
|
201
|
+
- test/ffi-glib/array_test.rb
|
202
|
+
- test/ffi-glib/hash_table_test.rb
|
203
|
+
- test/ffi-glib/byte_array_test.rb
|
189
204
|
- test/ffi-glib/glib_overrides_test.rb
|
205
|
+
- test/ffi-glib/list_test.rb
|
206
|
+
- test/ffi-glib/ptr_array_test.rb
|
190
207
|
- test/ffi-gobject/gobject_test.rb
|
191
208
|
- test/ffi-gobject/g_object_overrides_test.rb
|
209
|
+
- test/ffi-gobject/object_test.rb
|
192
210
|
- test/ffi-gobject/value_test.rb
|
193
211
|
- tasks/yardoc.rake
|
194
212
|
- tasks/rdoc.rake
|
@@ -212,50 +230,50 @@ files:
|
|
212
230
|
- Rakefile
|
213
231
|
homepage: http://www.github.com/mvz/ruby-gir-ffi
|
214
232
|
licenses: []
|
215
|
-
|
216
233
|
post_install_message:
|
217
|
-
rdoc_options:
|
234
|
+
rdoc_options:
|
218
235
|
- --main
|
219
236
|
- README.rdoc
|
220
|
-
require_paths:
|
237
|
+
require_paths:
|
221
238
|
- lib
|
222
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
239
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
223
240
|
none: false
|
224
|
-
requirements:
|
225
|
-
- -
|
226
|
-
- !ruby/object:Gem::Version
|
227
|
-
|
228
|
-
|
229
|
-
- 0
|
230
|
-
version: "0"
|
231
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ! '>='
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '0'
|
245
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
246
|
none: false
|
233
|
-
requirements:
|
234
|
-
- -
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
|
237
|
-
segments:
|
238
|
-
- 0
|
239
|
-
version: "0"
|
247
|
+
requirements:
|
248
|
+
- - ! '>='
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
240
251
|
requirements: []
|
241
|
-
|
242
252
|
rubyforge_project:
|
243
|
-
rubygems_version: 1.8.
|
253
|
+
rubygems_version: 1.8.11
|
244
254
|
signing_key:
|
245
255
|
specification_version: 3
|
246
256
|
summary: FFI-based GObject binding using the GObject Introspection Repository
|
247
|
-
test_files:
|
257
|
+
test_files:
|
248
258
|
- test/arg_helper_test.rb
|
249
259
|
- test/builder_test.rb
|
250
260
|
- test/class_base_test.rb
|
261
|
+
- test/ffi-glib/array_test.rb
|
262
|
+
- test/ffi-glib/byte_array_test.rb
|
251
263
|
- test/ffi-glib/glib_overrides_test.rb
|
264
|
+
- test/ffi-glib/hash_table_test.rb
|
265
|
+
- test/ffi-glib/list_test.rb
|
266
|
+
- test/ffi-glib/ptr_array_test.rb
|
267
|
+
- test/ffi-glib/s_list_test.rb
|
252
268
|
- test/ffi-gobject/g_object_overrides_test.rb
|
253
269
|
- test/ffi-gobject/gobject_test.rb
|
270
|
+
- test/ffi-gobject/object_test.rb
|
254
271
|
- test/ffi-gobject/value_test.rb
|
255
272
|
- test/ffi-gobject_introspection/i_base_info_test.rb
|
256
273
|
- test/ffi-gobject_introspection/i_constant_info_test.rb
|
257
274
|
- test/ffi-gobject_introspection/i_object_info_test.rb
|
258
275
|
- test/ffi-gobject_introspection/i_repository_test.rb
|
276
|
+
- test/ffi-gobject_introspection/lib_test.rb
|
259
277
|
- test/function_definition_builder_test.rb
|
260
278
|
- test/gir_ffi_test_helper.rb
|
261
279
|
- test/girffi_test.rb
|
@@ -265,18 +283,27 @@ test_files:
|
|
265
283
|
- test/integration/generated_gobject_test.rb
|
266
284
|
- test/integration/generated_gtk_test.rb
|
267
285
|
- test/integration/generated_regress_test.rb
|
286
|
+
- test/integration/pretty_print_test.rb
|
268
287
|
- test/interface_type_builder_test.rb
|
269
288
|
- test/lib/Makefile.am
|
270
289
|
- test/lib/autogen.sh
|
271
290
|
- test/lib/configure.ac
|
272
291
|
- test/lib/m4/jhflags.m4
|
273
|
-
- test/module_builder_test.rb
|
274
292
|
- test/test_helper.rb
|
275
293
|
- test/type_builder_test.rb
|
276
294
|
- test/unintrospectable_type_builder_test.rb
|
277
295
|
- test/unit/builder_test.rb
|
296
|
+
- test/unit/callback_builder_test.rb
|
278
297
|
- test/unit/callback_helper_test.rb
|
279
298
|
- test/unit/constant_builder_test.rb
|
299
|
+
- test/unit/enum_builder_test.rb
|
300
|
+
- test/unit/function_builder_test.rb
|
280
301
|
- test/unit/in_out_pointer_test.rb
|
281
302
|
- test/unit/in_pointer_test.rb
|
303
|
+
- test/unit/interface_builder_test.rb
|
304
|
+
- test/unit/module_builder_test.rb
|
282
305
|
- test/unit/object_type_builder_test.rb
|
306
|
+
- test/unit/struct_builder_test.rb
|
307
|
+
- test/unit/union_builder_test.rb
|
308
|
+
- test/unit/variable_name_generator_test.rb
|
309
|
+
has_rdoc:
|