gir_ffi 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,22 +1,22 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::Bytes do
4
- it "can succesfully be created with GLib::Bytes.new" do
4
+ it 'can succesfully be created with GLib::Bytes.new' do
5
5
  bytes = GLib::Bytes.new [1, 2, 3]
6
6
  bytes.must_be_instance_of GLib::Bytes
7
7
  end
8
8
 
9
- it "has a working #get_size method" do
9
+ it 'has a working #get_size method' do
10
10
  bytes = GLib::Bytes.new [1, 2, 3]
11
11
  bytes.get_size.must_equal 3
12
12
  end
13
13
 
14
- it "has a working #get_data method" do
14
+ it 'has a working #get_data method' do
15
15
  bytes = GLib::Bytes.new [1, 2, 3]
16
16
  bytes.get_data.to_a.must_equal [1, 2, 3]
17
17
  end
18
18
 
19
- it "has a working #each method" do
19
+ it 'has a working #each method' do
20
20
  a = []
21
21
  bytes = GLib::Bytes.new [1, 2, 3]
22
22
  bytes.each do |v|
@@ -25,25 +25,25 @@ describe GLib::Bytes do
25
25
  a.must_equal [3, 2, 1]
26
26
  end
27
27
 
28
- it "has a working #to_a method" do
28
+ it 'has a working #to_a method' do
29
29
  bytes = GLib::Bytes.new [1, 2, 3]
30
30
  bytes.to_a.must_equal [1, 2, 3]
31
31
  end
32
32
 
33
- describe ".from" do
34
- it "creates a GLib::Bytes object form an array of small integers" do
33
+ describe '.from' do
34
+ it 'creates a GLib::Bytes object form an array of small integers' do
35
35
  bytes = GLib::Bytes.from [1, 2, 3]
36
36
  bytes.must_be_instance_of GLib::Bytes
37
37
  bytes.to_a.must_equal [1, 2, 3]
38
38
  end
39
39
 
40
- it "returns its argument if given a GLib::Bytes object" do
40
+ it 'returns its argument if given a GLib::Bytes object' do
41
41
  bytes = GLib::Bytes.new [1, 2, 3]
42
42
  result = GLib::Bytes.from bytes
43
43
  assert result.equal?(bytes)
44
44
  end
45
45
 
46
- it "wraps its argument if given a pointer" do
46
+ it 'wraps its argument if given a pointer' do
47
47
  bytes = GLib::Bytes.new [1, 2, 3]
48
48
  ptr = bytes.to_ptr
49
49
  result = GLib::Bytes.from ptr
@@ -1,27 +1,27 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::HashTable do
4
- it "knows its key and value types" do
4
+ it 'knows its key and value types' do
5
5
  hsh = GLib::HashTable.new :gint32, :utf8
6
6
  assert_equal :gint32, hsh.key_type
7
7
  assert_equal :utf8, hsh.value_type
8
8
  end
9
9
 
10
- describe "::from" do
11
- it "creates a GHashTable from a Ruby hash" do
10
+ describe '::from' do
11
+ it 'creates a GHashTable from a Ruby hash' do
12
12
  hsh = GLib::HashTable.from [:utf8, :gint32],
13
- {"foo" => 23, "bar" => 32}
14
- assert_equal({"foo" => 23, "bar" => 32}, hsh.to_hash)
13
+ 'foo' => 23, 'bar' => 32
14
+ assert_equal({ 'foo' => 23, 'bar' => 32 }, hsh.to_hash)
15
15
  end
16
16
 
17
- it "return its argument if given a GHashTable" do
18
- hsh = GLib::HashTable.from [:utf8, :gint32], {"foo" => 23, "bar" => 32}
17
+ it 'return its argument if given a GHashTable' do
18
+ hsh = GLib::HashTable.from [:utf8, :gint32], 'foo' => 23, 'bar' => 32
19
19
  hsh2 = GLib::HashTable.from [:utf8, :gint32], hsh
20
20
  assert hsh2.equal? hsh
21
21
  end
22
22
 
23
- it "wraps its argument if given a pointer" do
24
- hsh = GLib::HashTable.from [:utf8, :gint32], {"foo" => 23, "bar" => 32}
23
+ it 'wraps its argument if given a pointer' do
24
+ hsh = GLib::HashTable.from [:utf8, :gint32], 'foo' => 23, 'bar' => 32
25
25
  pointer = hsh.to_ptr
26
26
  assert_instance_of FFI::Pointer, pointer
27
27
  hsh2 = GLib::HashTable.from [:utf8, :gint32], pointer
@@ -31,33 +31,36 @@ describe GLib::HashTable do
31
31
  end
32
32
  end
33
33
 
34
- it "allows key-value pairs to be inserted" do
34
+ it 'allows key-value pairs to be inserted' do
35
35
  h = GLib::HashTable.new :utf8, :utf8
36
- h.insert "foo", "bar"
37
- h.to_hash.must_equal "foo" => "bar"
36
+ h.insert 'foo', 'bar'
37
+ h.to_hash.must_equal 'foo' => 'bar'
38
38
  end
39
39
 
40
- it "includes Enumerable" do
41
- GLib::HashTable.must_include Enumerable
40
+ it 'includes Enumerable' do
41
+ GLib::HashTable.must_include Enumerable
42
42
  end
43
43
 
44
- describe "a HashTable provided by the system" do
44
+ describe 'a HashTable provided by the system' do
45
45
  before do
46
46
  GirFFI.setup :Regress
47
47
  @hash = Regress.test_ghash_container_return
48
48
  end
49
49
 
50
- it "has a working #each method" do
50
+ it 'has a working #each method' do
51
51
  a = {}
52
- @hash.each {|k, v| a[k] = v}
53
- a.must_be :==, {"foo" => "bar", "baz" => "bat",
54
- "qux" => "quux"}
52
+ @hash.each { |k, v| a[k] = v }
53
+ a.must_be :==,
54
+ 'foo' => 'bar',
55
+ 'baz' => 'bat',
56
+ 'qux' => 'quux'
55
57
  end
56
58
 
57
- it "has a working #to_hash method" do
58
- @hash.to_hash.must_be :==, {"foo" => "bar", "baz" => "bat",
59
- "qux" => "quux"}
59
+ it 'has a working #to_hash method' do
60
+ @hash.to_hash.must_be :==,
61
+ 'foo' => 'bar',
62
+ 'baz' => 'bat',
63
+ 'qux' => 'quux'
60
64
  end
61
65
  end
62
66
  end
63
-
@@ -1,16 +1,16 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::IConv do
4
- describe ".open" do
5
- it "creates a new instance of GLib::Iconv" do
6
- instance = GLib::IConv.open("ascii", "utf-8")
4
+ describe '.open' do
5
+ it 'creates a new instance of GLib::Iconv' do
6
+ instance = GLib::IConv.open('ascii', 'utf-8')
7
7
  instance.must_be_instance_of GLib::IConv
8
8
  end
9
9
  end
10
10
 
11
- let(:instance) { GLib::IConv.open("ascii", "utf-8") }
11
+ let(:instance) { GLib::IConv.open('ascii', 'utf-8') }
12
12
 
13
- describe "#setup_and_call" do
13
+ describe '#setup_and_call' do
14
14
  it "works for the method called ''" do
15
15
  instance.setup_and_call :'', [nil, nil, nil, nil]
16
16
  end
@@ -1,25 +1,25 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::List do
4
- it "knows its element type" do
4
+ it 'knows its element type' do
5
5
  arr = GLib::List.new :gint32
6
6
  assert_equal :gint32, arr.element_type
7
7
  end
8
8
 
9
- describe "#append" do
10
- it "appends integer values" do
9
+ describe '#append' do
10
+ it 'appends integer values' do
11
11
  lst = GLib::List.new :gint32
12
12
  res = lst.append 1
13
13
  assert_equal 1, res.data
14
14
  end
15
15
 
16
- it "appends string values" do
16
+ it 'appends string values' do
17
17
  lst = GLib::List.new :utf8
18
- res = lst.append "bla"
19
- assert_equal "bla", res.data
18
+ res = lst.append 'bla'
19
+ assert_equal 'bla', res.data
20
20
  end
21
21
 
22
- it "appends multiple values into a single list" do
22
+ it 'appends multiple values into a single list' do
23
23
  lst = GLib::List.new :gint32
24
24
 
25
25
  lst = lst.append 1
@@ -31,19 +31,19 @@ describe GLib::List do
31
31
  end
32
32
  end
33
33
 
34
- describe "::from" do
35
- it "creates a GList from a Ruby array" do
34
+ describe '::from' do
35
+ it 'creates a GList from a Ruby array' do
36
36
  lst = GLib::List.from :gint32, [3, 2, 1]
37
37
  assert_equal [3, 2, 1], lst.to_a
38
38
  end
39
39
 
40
- it "return its argument if given a GList" do
40
+ it 'return its argument if given a GList' do
41
41
  lst = GLib::List.from :gint32, [3, 2, 1]
42
42
  lst2 = GLib::List.from :gint32, lst
43
43
  assert lst2.equal? lst
44
44
  end
45
45
 
46
- it "wraps its argument if given a pointer" do
46
+ it 'wraps its argument if given a pointer' do
47
47
  lst = GLib::List.from :gint32, [3, 2, 1]
48
48
  pointer = lst.to_ptr
49
49
  assert_instance_of FFI::Pointer, pointer
@@ -54,27 +54,27 @@ describe GLib::List do
54
54
  end
55
55
  end
56
56
 
57
- describe "#==" do
58
- it "returns true when comparing to an array with the same elements" do
57
+ describe '#==' do
58
+ it 'returns true when comparing to an array with the same elements' do
59
59
  list = GLib::List.from :gint32, [1, 2, 3]
60
60
 
61
61
  list.must_be :==, [1, 2, 3]
62
62
  end
63
63
 
64
- it "returns false when comparing to an array with different elements" do
64
+ it 'returns false when comparing to an array with different elements' do
65
65
  list = GLib::List.from :gint32, [1, 2, 3]
66
66
 
67
67
  list.wont_be :==, [1, 2]
68
68
  end
69
69
 
70
- it "returns true when comparing to a list with the same elements" do
70
+ it 'returns true when comparing to a list with the same elements' do
71
71
  list = GLib::List.from :gint32, [1, 2, 3]
72
72
  other = GLib::List.from :gint32, [1, 2, 3]
73
73
 
74
74
  list.must_be :==, other
75
75
  end
76
76
 
77
- it "returns false when comparing to a list with different elements" do
77
+ it 'returns false when comparing to a list with different elements' do
78
78
  list = GLib::List.from :gint32, [1, 2, 3]
79
79
  other = GLib::List.from :gint32, [1, 2]
80
80
 
@@ -1,8 +1,8 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::MainLoop do
4
- describe "#run" do
5
- it "allows other threads to run" do
4
+ describe '#run' do
5
+ it 'allows other threads to run' do
6
6
  main_loop = GLib::MainLoop.new nil, false
7
7
 
8
8
  a = []
@@ -12,16 +12,16 @@ describe GLib::MainLoop do
12
12
 
13
13
  slow_thread = Thread.new do
14
14
  sleep 0.001
15
- a << "During run"
15
+ a << 'During run'
16
16
  end
17
17
 
18
- a << "Before run"
18
+ a << 'Before run'
19
19
  main_loop.run
20
- a << "After run"
20
+ a << 'After run'
21
21
 
22
22
  slow_thread.join
23
23
 
24
- a.last.must_equal "After run"
24
+ a.last.must_equal 'After run'
25
25
  end
26
26
  end
27
27
  end
@@ -1,108 +1,108 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::PtrArray do
4
- it "knows its element type" do
4
+ it 'knows its element type' do
5
5
  arr = GLib::PtrArray.new :utf8
6
6
  assert_equal :utf8, arr.element_type
7
7
  end
8
8
 
9
- describe "::add" do
10
- it "correctly takes the type into account" do
9
+ describe '::add' do
10
+ it 'correctly takes the type into account' do
11
11
  arr = GLib::PtrArray.new :utf8
12
- str = "test"
12
+ str = 'test'
13
13
  GLib::PtrArray.add arr, str
14
14
 
15
15
  assert_equal str, arr.pdata.read_pointer.read_string
16
16
  end
17
17
  end
18
18
 
19
- describe "#each" do
20
- it "works normally" do
19
+ describe '#each' do
20
+ it 'works normally' do
21
21
  arr = GLib::PtrArray.new :utf8
22
22
 
23
- GLib::PtrArray.add arr, "test1"
24
- GLib::PtrArray.add arr, "test2"
25
- GLib::PtrArray.add arr, "test3"
23
+ GLib::PtrArray.add arr, 'test1'
24
+ GLib::PtrArray.add arr, 'test2'
25
+ GLib::PtrArray.add arr, 'test3'
26
26
 
27
27
  a = []
28
- arr.each {|v| a << v}
28
+ arr.each { |v| a << v }
29
29
 
30
- assert_equal ["test1", "test2", "test3"], a
30
+ assert_equal %w(test1 test2 test3), a
31
31
  end
32
32
 
33
- it "works when exiting the loop prematurely" do
33
+ it 'works when exiting the loop prematurely' do
34
34
  arr = GLib::PtrArray.new :utf8
35
35
 
36
- GLib::PtrArray.add arr, "test1"
37
- GLib::PtrArray.add arr, "test2"
38
- GLib::PtrArray.add arr, "test3"
36
+ GLib::PtrArray.add arr, 'test1'
37
+ GLib::PtrArray.add arr, 'test2'
38
+ GLib::PtrArray.add arr, 'test3'
39
39
 
40
40
  a = []
41
41
  arr.each do |v|
42
42
  a << v
43
- break if v == "test2"
43
+ break if v == 'test2'
44
44
  end
45
45
 
46
- assert_equal ["test1", "test2"], a
46
+ assert_equal %w(test1 test2), a
47
47
  end
48
48
  end
49
49
 
50
- it "includes Enumerable" do
50
+ it 'includes Enumerable' do
51
51
  GLib::PtrArray.must_include Enumerable
52
52
  end
53
53
 
54
- it "has a working #to_a method" do
54
+ it 'has a working #to_a method' do
55
55
  arr = GLib::PtrArray.new :utf8
56
56
 
57
- GLib::PtrArray.add arr, "test1"
58
- GLib::PtrArray.add arr, "test2"
59
- GLib::PtrArray.add arr, "test3"
57
+ GLib::PtrArray.add arr, 'test1'
58
+ GLib::PtrArray.add arr, 'test2'
59
+ GLib::PtrArray.add arr, 'test3'
60
60
 
61
- assert_equal ["test1", "test2", "test3"], arr.to_a
61
+ assert_equal %w(test1 test2 test3), arr.to_a
62
62
  end
63
63
 
64
- it "has #add as an instance method too" do
64
+ it 'has #add as an instance method too' do
65
65
  arr = GLib::PtrArray.new :utf8
66
- arr.add "test1"
67
- assert_equal ["test1"], arr.to_a
66
+ arr.add 'test1'
67
+ assert_equal ['test1'], arr.to_a
68
68
  end
69
69
 
70
- describe "#==" do
71
- it "returns true when comparing to an array with the same elements" do
72
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
70
+ describe '#==' do
71
+ it 'returns true when comparing to an array with the same elements' do
72
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
73
73
 
74
- arr.must_be :==, ["1", "2", "3"]
74
+ arr.must_be :==, %w(1 2 3)
75
75
  end
76
76
 
77
- it "returns false when comparing to an array with different elements" do
78
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
77
+ it 'returns false when comparing to an array with different elements' do
78
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
79
79
 
80
- arr.wont_be :==, ["1", "2"]
80
+ arr.wont_be :==, %w(1 2)
81
81
  end
82
82
 
83
- it "returns true when comparing to a GPtrArray with the same elements" do
84
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
85
- other = GLib::PtrArray.from :utf8, ["1", "2", "3"]
83
+ it 'returns true when comparing to a GPtrArray with the same elements' do
84
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
85
+ other = GLib::PtrArray.from :utf8, %w(1 2 3)
86
86
 
87
87
  arr.must_be :==, other
88
88
  end
89
89
 
90
- it "returns false when comparing to a GPtrArray with different elements" do
91
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
92
- other = GLib::PtrArray.from :utf8, ["1", "2"]
90
+ it 'returns false when comparing to a GPtrArray with different elements' do
91
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
92
+ other = GLib::PtrArray.from :utf8, %w(1 2)
93
93
 
94
94
  arr.wont_be :==, other
95
95
  end
96
96
  end
97
97
 
98
- describe "#index" do
99
- it "returns the correct element" do
100
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
101
- arr.index(1).must_equal "2"
98
+ describe '#index' do
99
+ it 'returns the correct element' do
100
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
101
+ arr.index(1).must_equal '2'
102
102
  end
103
103
 
104
- it "raises an error if the index is out of bounds" do
105
- arr = GLib::PtrArray.from :utf8, ["1", "2", "3"]
104
+ it 'raises an error if the index is out of bounds' do
105
+ arr = GLib::PtrArray.from :utf8, %w(1 2 3)
106
106
  proc { arr.index(16) }.must_raise IndexError
107
107
  proc { arr.index(-1) }.must_raise IndexError
108
108
  end
@@ -1,18 +1,18 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GObject::RubyClosure do
4
- it "has a constructor with a mandatory block argument" do
4
+ it 'has a constructor with a mandatory block argument' do
5
5
  assert_raises ArgumentError do
6
6
  GObject::RubyClosure.new
7
7
  end
8
8
  end
9
9
 
10
- it "is a kind of Closure" do
10
+ it 'is a kind of Closure' do
11
11
  c = GObject::RubyClosure.new {}
12
12
  assert_kind_of GObject::Closure, c
13
13
  end
14
14
 
15
- it "is able to retrieve its block from its struct" do
15
+ it 'is able to retrieve its block from its struct' do
16
16
  a = 0
17
17
  c = GObject::RubyClosure.new { a = 2 }
18
18
  c2 = GObject::RubyClosure.wrap(c.to_ptr)
@@ -20,7 +20,7 @@ describe GObject::RubyClosure do
20
20
  assert_equal 2, a
21
21
  end
22
22
 
23
- describe "its #marshaller singleton method" do
23
+ describe 'its #marshaller singleton method' do
24
24
  it "invokes its closure argument's block" do
25
25
  a = 0
26
26
  c = GObject::RubyClosure.new { a = 2 }
@@ -28,7 +28,7 @@ describe GObject::RubyClosure do
28
28
  assert_equal 2, a
29
29
  end
30
30
 
31
- it "works when its closure argument is a GObject::Closure" do
31
+ it 'works when its closure argument is a GObject::Closure' do
32
32
  a = 0
33
33
  c = GObject::RubyClosure.new { a = 2 }
34
34
  c2 = GObject::Closure.wrap(c.to_ptr)
@@ -44,7 +44,7 @@ describe GObject::RubyClosure do
44
44
  end
45
45
  end
46
46
 
47
- it "has GObject::Closure#invoke call its block" do
47
+ it 'has GObject::Closure#invoke call its block' do
48
48
  a = 0
49
49
  c = GObject::RubyClosure.new { a = 2 }
50
50
  c2 = GObject::Closure.wrap(c.to_ptr)
@@ -1,25 +1,25 @@
1
1
  require 'gir_ffi_test_helper'
2
2
 
3
3
  describe GLib::SList do
4
- it "knows its element type" do
4
+ it 'knows its element type' do
5
5
  arr = GLib::SList.new :gint32
6
6
  assert_equal :gint32, arr.element_type
7
7
  end
8
8
 
9
- describe "#prepend" do
10
- it "prepends integer values" do
9
+ describe '#prepend' do
10
+ it 'prepends integer values' do
11
11
  lst = GLib::SList.new :gint32
12
12
  res = lst.prepend 1
13
13
  assert_equal 1, res.data
14
14
  end
15
15
 
16
- it "prepends string values" do
16
+ it 'prepends string values' do
17
17
  lst = GLib::SList.new :utf8
18
- res = lst.prepend "bla"
19
- assert_equal "bla", res.data
18
+ res = lst.prepend 'bla'
19
+ assert_equal 'bla', res.data
20
20
  end
21
21
 
22
- it "prepends multiple values into a single list" do
22
+ it 'prepends multiple values into a single list' do
23
23
  lst = GLib::SList.new :gint32
24
24
 
25
25
  res = lst.prepend 1
@@ -31,40 +31,40 @@ describe GLib::SList do
31
31
  end
32
32
  end
33
33
 
34
- describe "::from" do
35
- it "creates a GSList from a Ruby array" do
34
+ describe '::from' do
35
+ it 'creates a GSList from a Ruby array' do
36
36
  lst = GLib::SList.from :gint32, [3, 2, 1]
37
37
  assert_equal [3, 2, 1], lst.to_a
38
38
  end
39
39
 
40
- it "return its argument if given a GSList" do
40
+ it 'return its argument if given a GSList' do
41
41
  lst = GLib::SList.from :gint32, [3, 2, 1]
42
42
  lst2 = GLib::SList.from :gint32, lst
43
43
  assert_equal lst, lst2
44
44
  end
45
45
  end
46
46
 
47
- describe "#==" do
48
- it "returns true when comparing to an array with the same elements" do
47
+ describe '#==' do
48
+ it 'returns true when comparing to an array with the same elements' do
49
49
  list = GLib::SList.from :gint32, [1, 2, 3]
50
50
 
51
51
  list.must_be :==, [1, 2, 3]
52
52
  end
53
53
 
54
- it "returns false when comparing to an array with different elements" do
54
+ it 'returns false when comparing to an array with different elements' do
55
55
  list = GLib::SList.from :gint32, [1, 2, 3]
56
56
 
57
57
  list.wont_be :==, [1, 2]
58
58
  end
59
59
 
60
- it "returns true when comparing to a list with the same elements" do
60
+ it 'returns true when comparing to a list with the same elements' do
61
61
  list = GLib::SList.from :gint32, [1, 2, 3]
62
62
  other = GLib::SList.from :gint32, [1, 2, 3]
63
63
 
64
64
  list.must_be :==, other
65
65
  end
66
66
 
67
- it "returns false when comparing to a list with different elements" do
67
+ it 'returns false when comparing to a list with different elements' do
68
68
  list = GLib::SList.from :gint32, [1, 2, 3]
69
69
  other = GLib::SList.from :gint32, [1, 2]
70
70
 
@@ -1,21 +1,21 @@
1
1
  require 'base_test_helper'
2
2
 
3
3
  describe GLib::Strv do
4
- describe "::from" do
5
- it "creates a Strv from a Ruby array" do
6
- strv = GLib::Strv.from ["1", "2", "3"]
4
+ describe '::from' do
5
+ it 'creates a Strv from a Ruby array' do
6
+ strv = GLib::Strv.from %w(1 2 3)
7
7
  strv.must_be_instance_of GLib::Strv
8
- strv.to_a.must_equal ["1", "2", "3"]
8
+ strv.to_a.must_equal %w(1 2 3)
9
9
  end
10
10
 
11
- it "return its argument if given a Strv" do
12
- strv = GLib::Strv.from ["1", "2", "3"]
11
+ it 'return its argument if given a Strv' do
12
+ strv = GLib::Strv.from %w(1 2 3)
13
13
  strv2 = GLib::Strv.from strv
14
14
  assert strv2.equal? strv
15
15
  end
16
16
 
17
- it "wraps its argument if given a pointer" do
18
- strv = GLib::Strv.from ["1", "2", "3"]
17
+ it 'wraps its argument if given a pointer' do
18
+ strv = GLib::Strv.from %w(1 2 3)
19
19
 
20
20
  pointer = strv.to_ptr
21
21
  pointer.must_be_kind_of FFI::Pointer
@@ -28,29 +28,29 @@ describe GLib::Strv do
28
28
  end
29
29
  end
30
30
 
31
- describe "#==" do
32
- it "returns true when comparing to an array with the same elements" do
33
- strv = GLib::Strv.from ["1", "2", "3"]
31
+ describe '#==' do
32
+ it 'returns true when comparing to an array with the same elements' do
33
+ strv = GLib::Strv.from %w(1 2 3)
34
34
 
35
- strv.must_be :==, ["1", "2", "3"]
35
+ strv.must_be :==, %w(1 2 3)
36
36
  end
37
37
 
38
- it "returns false when comparing to an array with different elements" do
39
- strv = GLib::Strv.from ["1", "2", "3"]
38
+ it 'returns false when comparing to an array with different elements' do
39
+ strv = GLib::Strv.from %w(1 2 3)
40
40
 
41
- strv.wont_be :==, ["1", "2"]
41
+ strv.wont_be :==, %w(1 2)
42
42
  end
43
43
 
44
- it "returns true when comparing to a strv with the same elements" do
45
- strv = GLib::Strv.from ["1", "2", "3"]
46
- other = GLib::Strv.from ["1", "2", "3"]
44
+ it 'returns true when comparing to a strv with the same elements' do
45
+ strv = GLib::Strv.from %w(1 2 3)
46
+ other = GLib::Strv.from %w(1 2 3)
47
47
 
48
48
  strv.must_be :==, other
49
49
  end
50
50
 
51
- it "returns false when comparing to a strv with different elements" do
52
- strv = GLib::Strv.from ["1", "2", "3"]
53
- other = GLib::Strv.from ["1", "2"]
51
+ it 'returns false when comparing to a strv with different elements' do
52
+ strv = GLib::Strv.from %w(1 2 3)
53
+ other = GLib::Strv.from %w(1 2)
54
54
 
55
55
  strv.wont_be :==, other
56
56
  end