gir_ffi 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -0
  3. data/lib/ffi-glib/array.rb +1 -1
  4. data/lib/ffi-glib/error.rb +1 -2
  5. data/lib/ffi-glib/hash_table.rb +2 -2
  6. data/lib/ffi-glib/variant.rb +1 -1
  7. data/lib/ffi-gobject/base.rb +23 -23
  8. data/lib/ffi-gobject/object.rb +7 -3
  9. data/lib/ffi-gobject/value.rb +6 -1
  10. data/lib/ffi-gobject.rb +9 -6
  11. data/lib/ffi-gobject_introspection/i_base_info.rb +3 -3
  12. data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -1
  13. data/lib/ffi-gobject_introspection/i_repository.rb +4 -1
  14. data/lib/ffi-gobject_introspection/i_type_info.rb +1 -1
  15. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +7 -0
  16. data/lib/ffi-gobject_introspection/lib.rb +1 -1
  17. data/lib/gir_ffi/builders/argument_builder.rb +1 -1
  18. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +37 -29
  19. data/lib/gir_ffi/builders/callback_argument_builder.rb +57 -27
  20. data/lib/gir_ffi/builders/closure_convertor.rb +12 -8
  21. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +12 -8
  22. data/lib/gir_ffi/builders/constructor_result_convertor.rb +11 -7
  23. data/lib/gir_ffi/builders/field_builder.rb +1 -1
  24. data/lib/gir_ffi/builders/function_builder.rb +1 -1
  25. data/lib/gir_ffi/builders/mapping_method_builder.rb +1 -1
  26. data/lib/gir_ffi/builders/marshalling_method_builder.rb +2 -2
  27. data/lib/gir_ffi/builders/method_template.rb +1 -1
  28. data/lib/gir_ffi/builders/null_convertor.rb +11 -7
  29. data/lib/gir_ffi/builders/property_builder.rb +1 -1
  30. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +17 -13
  31. data/lib/gir_ffi/error_argument_info.rb +1 -1
  32. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  33. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +12 -0
  34. data/lib/gir_ffi/info_ext/safe_constant_name.rb +2 -2
  35. data/lib/gir_ffi/info_ext/safe_function_name.rb +1 -1
  36. data/lib/gir_ffi/info_ext.rb +1 -0
  37. data/lib/gir_ffi/module_base.rb +1 -1
  38. data/lib/gir_ffi/receiver_argument_info.rb +15 -12
  39. data/lib/gir_ffi/user_data_argument_info.rb +17 -15
  40. data/lib/gir_ffi/user_data_type_info.rb +14 -12
  41. data/lib/gir_ffi/version.rb +1 -1
  42. data/lib/gir_ffi-base/gobject/lib.rb +1 -1
  43. data/test/base_test_helper.rb +15 -15
  44. data/test/ffi-glib/array_test.rb +38 -38
  45. data/test/ffi-glib/byte_array_test.rb +6 -7
  46. data/test/ffi-glib/bytes_test.rb +9 -9
  47. data/test/ffi-glib/hash_table_test.rb +26 -23
  48. data/test/ffi-glib/iconv_test.rb +5 -5
  49. data/test/ffi-glib/list_test.rb +16 -16
  50. data/test/ffi-glib/main_loop_test.rb +6 -6
  51. data/test/ffi-glib/ptr_array_test.rb +45 -45
  52. data/test/ffi-glib/ruby_closure_test.rb +6 -6
  53. data/test/ffi-glib/s_list_test.rb +15 -15
  54. data/test/ffi-glib/strv_test.rb +21 -21
  55. data/test/ffi-glib/variant_test.rb +4 -4
  56. data/test/ffi-gobject/gobject_test.rb +35 -35
  57. data/test/ffi-gobject/object_class_test.rb +1 -1
  58. data/test/ffi-gobject/object_test.rb +29 -6
  59. data/test/ffi-gobject/value_test.rb +66 -52
  60. data/test/ffi-gobject_introspection/i_base_info_test.rb +10 -11
  61. data/test/ffi-gobject_introspection/i_constant_info_test.rb +6 -6
  62. data/test/ffi-gobject_introspection/i_enum_info_test.rb +4 -5
  63. data/test/ffi-gobject_introspection/i_function_info_test.rb +0 -2
  64. data/test/ffi-gobject_introspection/i_object_info_test.rb +5 -5
  65. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +9 -8
  66. data/test/ffi-gobject_introspection/i_repository_test.rb +16 -16
  67. data/test/ffi-gobject_introspection/i_type_info_test.rb +16 -2
  68. data/test/ffi-gobject_introspection/lib_test.rb +2 -2
  69. data/test/ffi-gobject_test.rb +50 -40
  70. data/test/gir_ffi/arg_helper_test.rb +5 -5
  71. data/test/gir_ffi/builder_test.rb +41 -41
  72. data/test/gir_ffi/builders/argument_builder_test.rb +240 -207
  73. data/test/gir_ffi/builders/base_argument_builder_test.rb +0 -1
  74. data/test/gir_ffi/builders/callback_argument_builder_test.rb +81 -15
  75. data/test/gir_ffi/builders/callback_builder_test.rb +39 -14
  76. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +41 -33
  77. data/test/gir_ffi/builders/enum_builder_test.rb +3 -3
  78. data/test/gir_ffi/builders/field_builder_test.rb +17 -17
  79. data/test/gir_ffi/builders/function_builder_test.rb +16 -16
  80. data/test/gir_ffi/builders/interface_builder_test.rb +9 -7
  81. data/test/gir_ffi/builders/module_builder_test.rb +5 -6
  82. data/test/gir_ffi/builders/object_builder_test.rb +24 -19
  83. data/test/gir_ffi/builders/property_builder_test.rb +25 -23
  84. data/test/gir_ffi/builders/registered_type_builder_test.rb +11 -11
  85. data/test/gir_ffi/builders/return_value_builder_test.rb +237 -197
  86. data/test/gir_ffi/builders/signal_closure_builder_test.rb +29 -22
  87. data/test/gir_ffi/builders/struct_builder_test.rb +10 -10
  88. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +8 -8
  89. data/test/gir_ffi/builders/union_builder_test.rb +5 -6
  90. data/test/gir_ffi/builders/user_defined_builder_test.rb +42 -33
  91. data/test/gir_ffi/builders/vfunc_builder_test.rb +37 -30
  92. data/test/gir_ffi/callback_base_test.rb +4 -5
  93. data/test/gir_ffi/class_base_test.rb +35 -28
  94. data/test/gir_ffi/error_type_info_test.rb +14 -14
  95. data/test/gir_ffi/ffi_ext/pointer_test.rb +4 -4
  96. data/test/gir_ffi/g_type_test.rb +6 -6
  97. data/test/gir_ffi/in_out_pointer_test.rb +27 -27
  98. data/test/gir_ffi/in_pointer_test.rb +54 -50
  99. data/test/gir_ffi/info_ext/i_callable_info_test.rb +8 -7
  100. data/test/gir_ffi/info_ext/i_callback_info_test.rb +7 -7
  101. data/test/gir_ffi/info_ext/i_field_info_test.rb +10 -8
  102. data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -15
  103. data/test/gir_ffi/info_ext/i_signal_info_test.rb +10 -8
  104. data/test/gir_ffi/info_ext/i_type_info_test.rb +158 -155
  105. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +17 -0
  106. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +12 -10
  107. data/test/gir_ffi/info_ext/safe_function_name_test.rb +12 -10
  108. data/test/gir_ffi/interface_base_test.rb +6 -6
  109. data/test/gir_ffi/method_stubber_test.rb +16 -13
  110. data/test/gir_ffi/object_base_test.rb +6 -6
  111. data/test/gir_ffi/sized_array_test.rb +23 -23
  112. data/test/gir_ffi/type_map_test.rb +3 -3
  113. data/test/gir_ffi/unintrospectable_type_info_test.rb +18 -18
  114. data/test/gir_ffi/user_defined_property_info_test.rb +4 -4
  115. data/test/gir_ffi/user_defined_type_info_test.rb +16 -16
  116. data/test/gir_ffi/variable_name_generator_test.rb +6 -6
  117. data/test/gir_ffi/version_test.rb +1 -1
  118. data/test/gir_ffi/zero_terminated_test.rb +16 -17
  119. data/test/gir_ffi-base/glib/boolean_test.rb +13 -13
  120. data/test/gir_ffi-base/glib/strv_test.rb +11 -11
  121. data/test/gir_ffi_test.rb +18 -18
  122. data/test/gir_ffi_test_helper.rb +13 -18
  123. data/test/integration/derived_classes_test.rb +8 -8
  124. data/test/integration/generated_gimarshallingtests_test.rb +794 -792
  125. data/test/integration/generated_gio_test.rb +25 -26
  126. data/test/integration/generated_glib_test.rb +8 -2
  127. data/test/integration/generated_gobject_test.rb +16 -9
  128. data/test/integration/generated_pango_ft2_test.rb +1 -2
  129. data/test/integration/generated_pango_test.rb +2 -2
  130. data/test/integration/generated_regress_test.rb +785 -705
  131. data/test/integration/generated_secret_test.rb +5 -5
  132. data/test/integration/method_lookup_test.rb +5 -5
  133. data/test/introspection_test_helper.rb +3 -1
  134. data/test/minitest/stats_plugin.rb +3 -3
  135. metadata +6 -3
@@ -0,0 +1,17 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ describe GirFFI::InfoExt::IUnresolvedInfo do
4
+ let(:klass) {
5
+ Class.new do
6
+ include GirFFI::InfoExt::IUnresolvedInfo
7
+ end
8
+ }
9
+
10
+ let(:unresolved_info) { klass.new }
11
+
12
+ describe '#to_ffitype' do
13
+ it 'returns the most generic type' do
14
+ unresolved_info.to_ffitype.must_equal :pointer
15
+ end
16
+ end
17
+ end
@@ -1,22 +1,24 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::InfoExt::SafeConstantName do
4
- let(:klass) { Class.new do
5
- include GirFFI::InfoExt::SafeConstantName
6
- end }
4
+ let(:klass) {
5
+ Class.new do
6
+ include GirFFI::InfoExt::SafeConstantName
7
+ end
8
+ }
7
9
  let(:info) { klass.new }
8
10
 
9
- describe "#safe_name" do
10
- it "makes names starting with an underscore safe" do
11
- mock(info).name { "_foo" }
11
+ describe '#safe_name' do
12
+ it 'makes names starting with an underscore safe' do
13
+ mock(info).name { '_foo' }
12
14
 
13
- assert_equal "Private___foo", info.safe_name
15
+ assert_equal 'Private___foo', info.safe_name
14
16
  end
15
17
 
16
- it "makes names with dashes safe" do
17
- mock(info).name { "this-could-be-a-signal-name" }
18
+ it 'makes names with dashes safe' do
19
+ mock(info).name { 'this-could-be-a-signal-name' }
18
20
 
19
- info.safe_name.must_equal "This_could_be_a_signal_name"
21
+ info.safe_name.must_equal 'This_could_be_a_signal_name'
20
22
  end
21
23
  end
22
24
  end
@@ -1,22 +1,24 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::InfoExt::SafeFunctionName do
4
- let(:klass) { Class.new do
5
- include GirFFI::InfoExt::SafeFunctionName
6
- end }
4
+ let(:klass) {
5
+ Class.new do
6
+ include GirFFI::InfoExt::SafeFunctionName
7
+ end
8
+ }
7
9
  let(:info) { klass.new }
8
10
 
9
- describe "#safe_name" do
10
- it "keeps lower case names lower case" do
11
- mock(info).name { "foo" }
11
+ describe '#safe_name' do
12
+ it 'keeps lower case names lower case' do
13
+ mock(info).name { 'foo' }
12
14
 
13
- assert_equal "foo", info.safe_name
15
+ assert_equal 'foo', info.safe_name
14
16
  end
15
17
 
16
- it "returns a non-empty string if name is empty" do
17
- mock(info).name { "" }
18
+ it 'returns a non-empty string if name is empty' do
19
+ mock(info).name { '' }
18
20
 
19
- assert_equal "_", info.safe_name
21
+ assert_equal '_', info.safe_name
20
22
  end
21
23
  end
22
24
  end
@@ -3,15 +3,15 @@ require 'gir_ffi_test_helper'
3
3
  describe GirFFI::InterfaceBase do
4
4
  let(:interface) { Module.new { extend GirFFI::InterfaceBase } }
5
5
 
6
- describe "#wrap" do
7
- it "delegates conversion to the wrapped pointer" do
8
- mock(ptr = Object.new).to_object { "good-result" }
9
- interface.wrap(ptr).must_equal "good-result"
6
+ describe '#wrap' do
7
+ it 'delegates conversion to the wrapped pointer' do
8
+ mock(ptr = Object.new).to_object { 'good-result' }
9
+ interface.wrap(ptr).must_equal 'good-result'
10
10
  end
11
11
  end
12
12
 
13
- describe ".to_ffitype" do
14
- it "returns :pointer" do
13
+ describe '.to_ffitype' do
14
+ it 'returns :pointer' do
15
15
  interface.to_ffitype.must_equal :pointer
16
16
  end
17
17
  end
@@ -1,15 +1,16 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::MethodStubber do
4
- describe "#method_stub" do
4
+ describe '#method_stub' do
5
5
  let(:stubber) { GirFFI::MethodStubber.new(method_info) }
6
6
  let(:result) { stubber.method_stub }
7
7
 
8
- describe "for a regular method" do
8
+ describe 'for a regular method' do
9
9
  let(:method_info) {
10
- get_method_introspection_data("Regress", "TestObj", "instance_method") }
10
+ get_method_introspection_data('Regress', 'TestObj', 'instance_method')
11
+ }
11
12
 
12
- it "creates a method stub" do
13
+ it 'creates a method stub' do
13
14
  result.must_equal <<-STUB.reset_indentation
14
15
  def instance_method *args, &block
15
16
  setup_and_call "instance_method", args, &block
@@ -18,11 +19,12 @@ describe GirFFI::MethodStubber do
18
19
  end
19
20
  end
20
21
 
21
- describe "for a static method" do
22
+ describe 'for a static method' do
22
23
  let(:method_info) {
23
- get_method_introspection_data("Regress", "TestObj", "static_method") }
24
+ get_method_introspection_data('Regress', 'TestObj', 'static_method')
25
+ }
24
26
 
25
- it "creates a class method stub" do
27
+ it 'creates a class method stub' do
26
28
  result.must_equal <<-STUB.reset_indentation
27
29
  def self.static_method *args, &block
28
30
  setup_and_call "static_method", args, &block
@@ -31,11 +33,12 @@ describe GirFFI::MethodStubber do
31
33
  end
32
34
  end
33
35
 
34
- describe "for a module function" do
36
+ describe 'for a module function' do
35
37
  let(:method_info) {
36
- get_introspection_data("Regress", "test_int") }
38
+ get_introspection_data('Regress', 'test_int')
39
+ }
37
40
 
38
- it "creates a module method stub" do
41
+ it 'creates a module method stub' do
39
42
  result.must_equal <<-STUB.reset_indentation
40
43
  def self.test_int *args, &block
41
44
  setup_and_call "test_int", args, &block
@@ -44,10 +47,10 @@ describe GirFFI::MethodStubber do
44
47
  end
45
48
  end
46
49
 
47
- describe "for a method with an empty name" do
48
- let(:method_info) { get_method_introspection_data("GLib", "IConv", "") }
50
+ describe 'for a method with an empty name' do
51
+ let(:method_info) { get_method_introspection_data('GLib', 'IConv', '') }
49
52
 
50
- it "creates a method stub with a safe name that sets up the unsafe method" do
53
+ it 'creates a method stub with a safe name that sets up the unsafe method' do
51
54
  result.must_equal <<-STUB.reset_indentation
52
55
  def _ *args, &block
53
56
  setup_and_call "", args, &block
@@ -3,15 +3,15 @@ require 'gir_ffi_test_helper'
3
3
  describe GirFFI::ObjectBase do
4
4
  let(:derived_class) { Class.new GirFFI::ObjectBase }
5
5
 
6
- describe ".wrap" do
7
- it "delegates conversion to the wrapped pointer" do
8
- mock(ptr = Object.new).to_object { "good-result" }
9
- derived_class.wrap(ptr).must_equal "good-result"
6
+ describe '.wrap' do
7
+ it 'delegates conversion to the wrapped pointer' do
8
+ mock(ptr = Object.new).to_object { 'good-result' }
9
+ derived_class.wrap(ptr).must_equal 'good-result'
10
10
  end
11
11
  end
12
12
 
13
- describe ".to_ffitype" do
14
- it "returns :pointer" do
13
+ describe '.to_ffitype' do
14
+ it 'returns :pointer' do
15
15
  derived_class.to_ffitype.must_equal :pointer
16
16
  end
17
17
  end
@@ -1,8 +1,8 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::SizedArray do
4
- describe "::wrap" do
5
- it "takes a type, size and pointer and returns a GirFFI::SizedArray wrapping them" do
4
+ describe '::wrap' do
5
+ it 'takes a type, size and pointer and returns a GirFFI::SizedArray wrapping them' do
6
6
  mock(ptr = Object.new).null? { false }
7
7
  sarr = GirFFI::SizedArray.wrap :gint32, 3, ptr
8
8
  assert_instance_of GirFFI::SizedArray, sarr
@@ -11,17 +11,17 @@ describe GirFFI::SizedArray do
11
11
  assert_equal :gint32, sarr.element_type
12
12
  end
13
13
 
14
- it "returns nil if the wrapped pointer is null" do
14
+ it 'returns nil if the wrapped pointer is null' do
15
15
  mock(ptr = Object.new).null? { true }
16
16
  sarr = GirFFI::SizedArray.wrap :gint32, 3, ptr
17
17
  sarr.must_be_nil
18
18
  end
19
19
  end
20
20
 
21
- describe "#each" do
22
- it "yields each element" do
23
- ary = ["one", "two", "three"]
24
- ptrs = ary.map {|a| FFI::MemoryPointer.from_string(a)}
21
+ describe '#each' do
22
+ it 'yields each element' do
23
+ ary = %w(one two three)
24
+ ptrs = ary.map { |a| FFI::MemoryPointer.from_string(a) }
25
25
  ptrs << nil
26
26
  block = FFI::MemoryPointer.new(:pointer, ptrs.length)
27
27
  block.write_array_of_pointer ptrs
@@ -31,19 +31,19 @@ describe GirFFI::SizedArray do
31
31
  sarr.each do |str|
32
32
  arr << str
33
33
  end
34
- assert_equal ["one", "two", "three"], arr
34
+ assert_equal %w(one two three), arr
35
35
  end
36
36
  end
37
37
 
38
- describe "::from" do
39
- describe "from a Ruby array" do
40
- it "creates a GirFFI::SizedArray with the same elements" do
38
+ describe '::from' do
39
+ describe 'from a Ruby array' do
40
+ it 'creates a GirFFI::SizedArray with the same elements' do
41
41
  arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
42
42
  arr.must_be_instance_of GirFFI::SizedArray
43
43
  assert_equal [3, 2, 1], arr.to_a
44
44
  end
45
45
 
46
- it "raises an error if the array has the wrong number of elements" do
46
+ it 'raises an error if the array has the wrong number of elements' do
47
47
  proc { GirFFI::SizedArray.from :gint32, 4, [3, 2, 1] }.must_raise ArgumentError
48
48
  end
49
49
 
@@ -53,25 +53,25 @@ describe GirFFI::SizedArray do
53
53
  end
54
54
  end
55
55
 
56
- describe "from a GirFFI::SizedArray" do
57
- it "return its argument" do
56
+ describe 'from a GirFFI::SizedArray' do
57
+ it 'return its argument' do
58
58
  arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
59
59
  arr2 = GirFFI::SizedArray.from :gint32, 3, arr
60
60
  assert_equal arr, arr2
61
61
  end
62
62
 
63
- it "raises an error if the argument has the wrong number of elements" do
63
+ it 'raises an error if the argument has the wrong number of elements' do
64
64
  arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
65
65
  proc { GirFFI::SizedArray.from :gint32, 4, arr }.must_raise ArgumentError
66
66
  end
67
67
  end
68
68
 
69
- it "returns nil when passed nil" do
69
+ it 'returns nil when passed nil' do
70
70
  arr = GirFFI::SizedArray.from :gint32, 0, nil
71
71
  arr.must_be_nil
72
72
  end
73
73
 
74
- it "wraps its argument if given a pointer" do
74
+ it 'wraps its argument if given a pointer' do
75
75
  arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
76
76
  arr2 = GirFFI::SizedArray.from :gint32, 3, arr.to_ptr
77
77
  assert_instance_of GirFFI::SizedArray, arr2
@@ -80,27 +80,27 @@ describe GirFFI::SizedArray do
80
80
  end
81
81
  end
82
82
 
83
- describe "#==" do
84
- it "returns true when comparing to an array with the same elements" do
83
+ describe '#==' do
84
+ it 'returns true when comparing to an array with the same elements' do
85
85
  sized = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
86
86
 
87
87
  sized.must_be :==, [1, 2, 3]
88
88
  end
89
89
 
90
- it "returns false when comparing to an array with different elements" do
90
+ it 'returns false when comparing to an array with different elements' do
91
91
  sized = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
92
92
 
93
93
  sized.wont_be :==, [1, 2]
94
94
  end
95
95
 
96
- it "returns true when comparing to a sized array with the same elements" do
96
+ it 'returns true when comparing to a sized array with the same elements' do
97
97
  sized = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
98
98
  other = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
99
99
 
100
100
  sized.must_be :==, other
101
101
  end
102
102
 
103
- it "returns false when comparing to a sized array with different elements" do
103
+ it 'returns false when comparing to a sized array with different elements' do
104
104
  sized = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
105
105
  other = GirFFI::SizedArray.from :int32, 2, [1, 2]
106
106
 
@@ -108,7 +108,7 @@ describe GirFFI::SizedArray do
108
108
  end
109
109
  end
110
110
 
111
- it "includes Enumerable" do
111
+ it 'includes Enumerable' do
112
112
  GirFFI::SizedArray.must_include Enumerable
113
113
  end
114
114
  end
@@ -1,13 +1,13 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::TypeMap do
4
- describe ".type_specification_to_ffitype" do
5
- it "returns the nested FFI::Enum for an Enum module" do
4
+ describe '.type_specification_to_ffitype' do
5
+ it 'returns the nested FFI::Enum for an Enum module' do
6
6
  GirFFI::TypeMap.type_specification_to_ffitype(GLib::DateMonth).
7
7
  must_equal GLib::DateMonth
8
8
  end
9
9
 
10
- it "returns the class itself for a Struct class" do
10
+ it 'returns the class itself for a Struct class' do
11
11
  GirFFI::TypeMap.type_specification_to_ffitype(GObject::EnumValue).
12
12
  must_equal GObject::EnumValue
13
13
  end
@@ -2,15 +2,15 @@ require 'gir_ffi_test_helper'
2
2
  require 'gir_ffi/unintrospectable_type_info'
3
3
 
4
4
  describe GirFFI::UnintrospectableTypeInfo do
5
- describe "#info_type" do
6
- it "returns :unintrospectable" do
5
+ describe '#info_type' do
6
+ it 'returns :unintrospectable' do
7
7
  info = GirFFI::UnintrospectableTypeInfo.new :some_type
8
8
  info.info_type.must_equal :unintrospectable
9
9
  end
10
10
  end
11
11
 
12
- describe "#parent" do
13
- describe "when the GIR knows about the parent gtype" do
12
+ describe '#parent' do
13
+ describe 'when the GIR knows about the parent gtype' do
14
14
  it "finds the parent's info by gtype" do
15
15
  gobject = Object.new
16
16
  gir = Object.new
@@ -24,8 +24,8 @@ describe GirFFI::UnintrospectableTypeInfo do
24
24
  end
25
25
  end
26
26
 
27
- describe "when the GIR does not know about the parent gtype" do
28
- it "creates a new UnintrospectableTypeInfo from the parent gtype" do
27
+ describe 'when the GIR does not know about the parent gtype' do
28
+ it 'creates a new UnintrospectableTypeInfo from the parent gtype' do
29
29
  gobject = Object.new
30
30
  gir = Object.new
31
31
 
@@ -39,12 +39,12 @@ describe GirFFI::UnintrospectableTypeInfo do
39
39
  end
40
40
  end
41
41
 
42
- describe "#interfaces" do
43
- it "finds interface infos by gtype" do
42
+ describe '#interfaces' do
43
+ it 'finds interface infos by gtype' do
44
44
  gobject = Object.new
45
45
  gir = Object.new
46
46
 
47
- mock(gobject).type_interfaces(:some_type) { [:foo, :bar ] }
47
+ mock(gobject).type_interfaces(:some_type) { [:foo, :bar] }
48
48
  mock(gir).find_by_gtype(:foo) { :foo_info }
49
49
  mock(gir).find_by_gtype(:bar) { :bar_info }
50
50
 
@@ -53,11 +53,11 @@ describe GirFFI::UnintrospectableTypeInfo do
53
53
  info.interfaces.must_equal [:foo_info, :bar_info]
54
54
  end
55
55
 
56
- it "skips interfaces that have no introspection data" do
56
+ it 'skips interfaces that have no introspection data' do
57
57
  gobject = Object.new
58
58
  gir = Object.new
59
59
 
60
- mock(gobject).type_interfaces(:some_type) { [:foo, :bar ] }
60
+ mock(gobject).type_interfaces(:some_type) { [:foo, :bar] }
61
61
  mock(gir).find_by_gtype(:foo) { :foo_info }
62
62
  mock(gir).find_by_gtype(:bar) { nil }
63
63
 
@@ -67,21 +67,21 @@ describe GirFFI::UnintrospectableTypeInfo do
67
67
  end
68
68
  end
69
69
 
70
- describe "#g_type" do
71
- it "returns the passed-in gtype" do
70
+ describe '#g_type' do
71
+ it 'returns the passed-in gtype' do
72
72
  info = GirFFI::UnintrospectableTypeInfo.new(:some_type)
73
73
  info.g_type.must_equal :some_type
74
74
  end
75
75
  end
76
76
 
77
- describe "#fields" do
78
- it "returns an empty array" do
77
+ describe '#fields' do
78
+ it 'returns an empty array' do
79
79
  info = GirFFI::UnintrospectableTypeInfo.new(:some_type)
80
80
  info.fields.must_equal []
81
81
  end
82
82
  end
83
83
 
84
- describe "#namespace" do
84
+ describe '#namespace' do
85
85
  it "returns the parent class' namespace" do
86
86
  gobject = Object.new
87
87
  gir = Object.new
@@ -97,8 +97,8 @@ describe GirFFI::UnintrospectableTypeInfo do
97
97
  end
98
98
  end
99
99
 
100
- describe "#safe_name" do
101
- it "finds the class name by gtype" do
100
+ describe '#safe_name' do
101
+ it 'finds the class name by gtype' do
102
102
  gobject = Object.new
103
103
 
104
104
  mock(gobject).type_name(:some_type) { 'GSomeType' }
@@ -2,15 +2,15 @@ require 'gir_ffi_test_helper'
2
2
  require 'gir_ffi/user_defined_property_info'
3
3
 
4
4
  describe GirFFI::UserDefinedPropertyInfo do
5
- describe "#param_spec" do
6
- it "returns the passed in parameter specification" do
5
+ describe '#param_spec' do
6
+ it 'returns the passed in parameter specification' do
7
7
  info = GirFFI::UserDefinedPropertyInfo.new :some_param_spec
8
8
  info.param_spec.must_equal :some_param_spec
9
9
  end
10
10
  end
11
11
 
12
- describe "#name" do
13
- it "returns the name retrieved from the parameter specification" do
12
+ describe '#name' do
13
+ it 'returns the name retrieved from the parameter specification' do
14
14
  mock(param_spec = Object.new).get_name { :property_name }
15
15
  info = GirFFI::UserDefinedPropertyInfo.new param_spec
16
16
  info.name.must_equal :property_name
@@ -2,15 +2,15 @@ require 'gir_ffi_test_helper'
2
2
  require 'gir_ffi/user_defined_type_info'
3
3
 
4
4
  describe GirFFI::UserDefinedTypeInfo do
5
- describe "#described_class" do
6
- it "returns the class passed to #initialize" do
5
+ describe '#described_class' do
6
+ it 'returns the class passed to #initialize' do
7
7
  info = GirFFI::UserDefinedTypeInfo.new :some_class
8
8
  info.described_class.must_equal :some_class
9
9
  end
10
10
  end
11
11
 
12
- describe "#install_property" do
13
- it "adds the passed in property to the list of properties" do
12
+ describe '#install_property' do
13
+ it 'adds the passed in property to the list of properties' do
14
14
  mock(foo_spec = Object.new).get_name { :foo }
15
15
 
16
16
  info = GirFFI::UserDefinedTypeInfo.new :some_class
@@ -19,25 +19,25 @@ describe GirFFI::UserDefinedTypeInfo do
19
19
  end
20
20
  end
21
21
 
22
- describe "#install_vfunc_implementation" do
22
+ describe '#install_vfunc_implementation' do
23
23
  let(:info) { GirFFI::UserDefinedTypeInfo.new :some_class }
24
24
  let(:implementation) { Object.new }
25
25
 
26
- it "adds to the list of vfunc implementations" do
26
+ it 'adds to the list of vfunc implementations' do
27
27
  info.vfunc_implementations.must_equal []
28
28
  info.install_vfunc_implementation :foo, implementation
29
29
  info.vfunc_implementations.map(&:name).must_equal [:foo]
30
30
  end
31
31
 
32
- it "stores the passed-in implementation in the implementation object" do
32
+ it 'stores the passed-in implementation in the implementation object' do
33
33
  info.install_vfunc_implementation :foo, implementation
34
34
  impl = info.vfunc_implementations.first
35
35
  impl.implementation.must_equal implementation
36
36
  end
37
37
  end
38
38
 
39
- describe "#initialize" do
40
- it "yields the new object to the block passed" do
39
+ describe '#initialize' do
40
+ it 'yields the new object to the block passed' do
41
41
  mock(foo_spec = Object.new).get_name { :foo }
42
42
  mock(bar_spec = Object.new).get_name { :bar }
43
43
 
@@ -49,18 +49,18 @@ describe GirFFI::UserDefinedTypeInfo do
49
49
  end
50
50
  end
51
51
 
52
- describe "#g_name" do
52
+ describe '#g_name' do
53
53
  it "returns the described class' name by default" do
54
- mock(klass = Object.new).name { "foo" }
54
+ mock(klass = Object.new).name { 'foo' }
55
55
  info = GirFFI::UserDefinedTypeInfo.new klass
56
- info.g_name.must_equal "foo"
56
+ info.g_name.must_equal 'foo'
57
57
  end
58
58
 
59
- it "returns the the name set by #g_name= if present" do
60
- stub(klass = Object.new).name { "foo" }
59
+ it 'returns the the name set by #g_name= if present' do
60
+ stub(klass = Object.new).name { 'foo' }
61
61
  info = GirFFI::UserDefinedTypeInfo.new klass
62
- info.g_name = "bar"
63
- info.g_name.must_equal "bar"
62
+ info.g_name = 'bar'
63
+ info.g_name.must_equal 'bar'
64
64
  end
65
65
  end
66
66
  end
@@ -3,14 +3,14 @@ require 'gir_ffi_test_helper'
3
3
  require 'gir_ffi/variable_name_generator'
4
4
 
5
5
  describe GirFFI::VariableNameGenerator do
6
- describe "#new_var" do
7
- it "generates a sequence of predictable variable names" do
6
+ describe '#new_var' do
7
+ it 'generates a sequence of predictable variable names' do
8
8
  gen = GirFFI::VariableNameGenerator.new
9
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
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
14
  end
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GirFFI::VERSION do
4
- it "is set to a valid version number" do
4
+ it 'is set to a valid version number' do
5
5
  GirFFI::VERSION.must_match(/\d\.\d\.\d/)
6
6
  end
7
7
  end