gir_ffi 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/History.txt +6 -0
  2. data/lib/ffi-glib/array.rb +12 -3
  3. data/lib/ffi-glib/list_methods.rb +4 -0
  4. data/lib/ffi-glib/ptr_array.rb +4 -0
  5. data/lib/ffi-glib/sized_array.rb +4 -0
  6. data/lib/ffi-glib/strv.rb +4 -1
  7. data/lib/gir_ffi/arg_helper.rb +5 -27
  8. data/lib/gir_ffi/class_base.rb +8 -0
  9. data/lib/gir_ffi/enum_base.rb +8 -0
  10. data/lib/gir_ffi/ffi_ext/pointer.rb +12 -0
  11. data/lib/gir_ffi/in_out_pointer.rb +3 -13
  12. data/lib/gir_ffi/in_pointer.rb +19 -1
  13. data/lib/gir_ffi/info_ext/i_enum_info.rb +0 -2
  14. data/lib/gir_ffi/info_ext/i_object_info.rb +1 -1
  15. data/lib/gir_ffi/info_ext/i_type_info.rb +3 -14
  16. data/lib/gir_ffi/module_base.rb +1 -0
  17. data/lib/gir_ffi/type_map.rb +6 -8
  18. data/lib/gir_ffi/version.rb +1 -1
  19. data/lib/gir_ffi/zero_terminated.rb +5 -1
  20. data/tasks/test.rake +1 -0
  21. data/test/ffi-glib/array_test.rb +41 -7
  22. data/test/ffi-glib/hash_table_test.rb +3 -3
  23. data/test/ffi-glib/list_test.rb +31 -3
  24. data/test/ffi-glib/ptr_array_test.rb +28 -0
  25. data/test/ffi-glib/s_list_test.rb +28 -0
  26. data/test/ffi-glib/sized_array_test.rb +30 -3
  27. data/test/ffi-glib/strv_test.rb +31 -0
  28. data/test/ffi-gobject_test.rb +2 -2
  29. data/test/gir_ffi/arg_helper_test.rb +3 -2
  30. data/test/gir_ffi/class_base_test.rb +62 -4
  31. data/test/gir_ffi/function_builder_test.rb +1 -1
  32. data/test/gir_ffi/in_pointer_test.rb +17 -0
  33. data/test/gir_ffi/info_ext/i_object_info_test.rb +14 -0
  34. data/test/gir_ffi/info_ext/i_type_info_test.rb +79 -25
  35. data/test/gir_ffi/type_map_test.rb +15 -0
  36. data/test/gir_ffi/zero_terminated_test.rb +28 -0
  37. data/test/integration/generated_gimarshallingtests_test.rb +90 -75
  38. data/test/integration/generated_pango_test.rb +1 -1
  39. data/test/integration/generated_regress_test.rb +64 -39
  40. metadata +8 -18
@@ -17,7 +17,7 @@ describe Pango do
17
17
  scripts = GLib::SizedArray.new Pango::Script, size, ptr
18
18
  end
19
19
 
20
- scripts.to_a.must_equal [:han, :katakana, :hiragana]
20
+ scripts.must_be :==, [:han, :katakana, :hiragana]
21
21
  end
22
22
  end
23
23
  end
@@ -499,8 +499,8 @@ describe Regress do
499
499
 
500
500
  obj2 = instance.get_property("bare")
501
501
 
502
- assert_equal obj.to_ptr, obj2.to_ptr
503
502
  assert_instance_of Regress::TestObj, obj2
503
+ obj2.must_equal obj
504
504
  end
505
505
 
506
506
  it "gets the 'boxed' property" do
@@ -545,7 +545,7 @@ describe Regress do
545
545
  instance.set_property "list", lst
546
546
 
547
547
  lst2 = instance.get_property "list"
548
- assert_equal ["foo", "bar"], lst2.to_a
548
+ lst2.must_be :==, ["foo", "bar"]
549
549
  end
550
550
 
551
551
  it "gets the 'string' property" do
@@ -558,7 +558,7 @@ describe Regress do
558
558
  it "sets the 'bare' property" do
559
559
  obj = Regress::TestObj.new_from_file("bar")
560
560
  instance.set_property "bare", obj
561
- assert_equal obj.to_ptr, instance.bare.to_ptr
561
+ instance.bare.must_equal obj
562
562
  end
563
563
 
564
564
  it "sets the 'boxed' property" do
@@ -595,8 +595,7 @@ describe Regress do
595
595
 
596
596
  it "sets the 'list' property" do
597
597
  instance.set_property "list", ["foo", "bar"]
598
- assert_equal ["foo", "bar"],
599
- GLib::List.wrap(:utf8, instance.list.to_ptr).to_a
598
+ instance.list.must_be :==, ["foo", "bar"]
600
599
  end
601
600
 
602
601
  it "sets the 'string' property" do
@@ -667,9 +666,9 @@ describe Regress do
667
666
 
668
667
  it "has a working method #set_bare" do
669
668
  obj = Regress::TestObj.new_from_file("bar")
669
+ # XXX: Sometimes uses set_property, and it shouldn't?
670
670
  instance.set_bare obj
671
- # TODO: What is the correct value to retrieve from the fields?
672
- assert_equal obj.to_ptr, instance.bare.to_ptr
671
+ instance.bare.must_equal obj
673
672
  end
674
673
 
675
674
  it "has a working method #skip_inout_param" do
@@ -723,8 +722,7 @@ describe Regress do
723
722
  o = Regress::TestSubObj.new
724
723
  GObject.signal_connect(o, "test", 2) { |i, d| a = d; b = i }
725
724
  GObject.signal_emit o, "test"
726
- # TODO: store o's identity somewhere so we can make o == b.
727
- assert_equal [2, o.to_ptr], [a, b.to_ptr]
725
+ assert_equal [2, o], [a, b]
728
726
  end
729
727
  end
730
728
 
@@ -935,15 +933,45 @@ describe Regress do
935
933
  end
936
934
 
937
935
  describe "Regress::TestStructC" do
938
- it "must be tested" do
939
- skip
936
+ let(:instance) { Regress::TestStructC.new }
937
+ it "has a writable field another_int" do
938
+ instance.another_int.must_equal 0
939
+ instance.another_int = 42
940
+ instance.another_int.must_equal 42
941
+ end
942
+
943
+ it "has a writable field obj" do
944
+ o = Regress::TestSubObj.new
945
+ instance.obj.must_equal nil
946
+ instance.obj = o
947
+ instance.obj.must_equal o
940
948
  end
941
949
  end
950
+
942
951
  describe "Regress::TestStructD" do
943
- it "must be tested" do
944
- skip
952
+ let(:instance) { Regress::TestStructD.new }
953
+ it "has a writable field array1" do
954
+ instance.array1.must_be :==, []
955
+ struct = Regress::TestStructA.new
956
+ instance.array1 = [struct]
957
+ instance.array1.must_be :==, [struct]
958
+ end
959
+
960
+ it "has a writable field array2" do
961
+ instance.array2.must_be :==, []
962
+ o = Regress::TestSubObj.new
963
+ instance.array2 = [o]
964
+ instance.array2.must_be :==, [o]
965
+ end
966
+
967
+ it "has a writable field field" do
968
+ instance.field.must_equal nil
969
+ o = Regress::TestSubObj.new
970
+ instance.field = o
971
+ instance.field.must_equal o
945
972
  end
946
973
  end
974
+
947
975
  describe "Regress::TestStructE" do
948
976
  it "must be tested" do
949
977
  skip
@@ -1077,16 +1105,13 @@ describe Regress do
1077
1105
  end
1078
1106
 
1079
1107
  it "has a working function #test_array_fixed_out_objects" do
1080
- result = Regress.test_array_fixed_out_objects.to_a
1108
+ result = Regress.test_array_fixed_out_objects
1109
+ gtype = Regress::TestObj.get_gtype
1081
1110
 
1082
- assert_equal 2, result.length
1111
+ result.size.must_equal 2
1083
1112
 
1084
1113
  result.each {|o|
1085
1114
  assert_instance_of Regress::TestObj, o
1086
- }
1087
-
1088
- gtype = Regress::TestObj.get_gtype
1089
- result.each {|o|
1090
1115
  assert_equal gtype, GObject.type_from_instance(o)
1091
1116
  }
1092
1117
  end
@@ -1104,11 +1129,11 @@ describe Regress do
1104
1129
  end
1105
1130
 
1106
1131
  it "has a working function #test_array_fixed_size_int_out" do
1107
- assert_equal [0, 1, 2, 3, 4], Regress.test_array_fixed_size_int_out.to_a
1132
+ Regress.test_array_fixed_size_int_out.must_be :==, [0, 1, 2, 3, 4]
1108
1133
  end
1109
1134
 
1110
1135
  it "has a working function #test_array_fixed_size_int_return" do
1111
- assert_equal [0, 1, 2, 3, 4], Regress.test_array_fixed_size_int_return.to_a
1136
+ Regress.test_array_fixed_size_int_return.must_be :==, [0, 1, 2, 3, 4]
1112
1137
  end
1113
1138
 
1114
1139
  it "has a working function #test_array_gint16_in" do
@@ -1134,7 +1159,7 @@ describe Regress do
1134
1159
  end
1135
1160
 
1136
1161
  it "has a working function #test_array_int_full_out" do
1137
- assert_equal [0, 1, 2, 3, 4], Regress.test_array_int_full_out.to_a
1162
+ Regress.test_array_int_full_out.must_be :==, [0, 1, 2, 3, 4]
1138
1163
  end
1139
1164
 
1140
1165
  it "has a working function #test_array_int_in" do
@@ -1142,11 +1167,11 @@ describe Regress do
1142
1167
  end
1143
1168
 
1144
1169
  it "has a working function #test_array_int_inout" do
1145
- assert_equal [3, 4], Regress.test_array_int_inout([5, 2, 3]).to_a
1170
+ Regress.test_array_int_inout([5, 2, 3]).must_be :==, [3, 4]
1146
1171
  end
1147
1172
 
1148
1173
  it "has a working function #test_array_int_none_out" do
1149
- assert_equal [1, 2, 3, 4, 5], Regress.test_array_int_none_out.to_a
1174
+ Regress.test_array_int_none_out.must_be :==, [1, 2, 3, 4, 5]
1150
1175
  end
1151
1176
 
1152
1177
  it "has a working function #test_array_int_null_in" do
@@ -1158,7 +1183,7 @@ describe Regress do
1158
1183
  end
1159
1184
 
1160
1185
  it "has a working function #test_array_int_out" do
1161
- assert_equal [0, 1, 2, 3, 4], Regress.test_array_int_out.to_a
1186
+ Regress.test_array_int_out.must_be :==, [0, 1, 2, 3, 4]
1162
1187
  end
1163
1188
 
1164
1189
  it "has a working function #test_async_ready_callback" do
@@ -1323,7 +1348,7 @@ describe Regress do
1323
1348
  # TODO: Find a way to test encoding issues.
1324
1349
  it "has a working function #test_filename_return" do
1325
1350
  arr = Regress.test_filename_return
1326
- assert_equal ["åäö", "/etc/fstab"], arr.to_a
1351
+ arr.must_be :==, ["åäö", "/etc/fstab"]
1327
1352
  end
1328
1353
 
1329
1354
  it "has a working function #test_float" do
@@ -1414,12 +1439,12 @@ describe Regress do
1414
1439
  it "has a working function #test_glist_container_return" do
1415
1440
  list = Regress.test_glist_container_return
1416
1441
  assert_instance_of GLib::List, list
1417
- assert_equal ["1", "2", "3"], list.to_a
1442
+ list.must_be :==, ["1", "2", "3"]
1418
1443
  end
1419
1444
 
1420
1445
  it "has a working function #test_glist_everything_return" do
1421
1446
  list = Regress.test_glist_everything_return
1422
- assert_equal ["1", "2", "3"], list.to_a
1447
+ list.must_be :==, ["1", "2", "3"]
1423
1448
  end
1424
1449
 
1425
1450
  it "has a working function #test_glist_nothing_in" do
@@ -1436,12 +1461,12 @@ describe Regress do
1436
1461
 
1437
1462
  it "has a working function #test_glist_nothing_return" do
1438
1463
  list = Regress.test_glist_nothing_return
1439
- assert_equal ["1", "2", "3"], list.to_a
1464
+ list.must_be :==, ["1", "2", "3"]
1440
1465
  end
1441
1466
 
1442
1467
  it "has a working function #test_glist_nothing_return2" do
1443
1468
  list = Regress.test_glist_nothing_return2
1444
- assert_equal ["1", "2", "3"], list.to_a
1469
+ list.must_be :==, ["1", "2", "3"]
1445
1470
  end
1446
1471
 
1447
1472
  it "has a working function #test_glist_null_in" do
@@ -1458,12 +1483,12 @@ describe Regress do
1458
1483
  it "has a working function #test_gslist_container_return" do
1459
1484
  slist = Regress.test_gslist_container_return
1460
1485
  assert_instance_of GLib::SList, slist
1461
- assert_equal ["1", "2", "3"], slist.to_a
1486
+ slist.must_be :==, ["1", "2", "3"]
1462
1487
  end
1463
1488
 
1464
1489
  it "has a working function #test_gslist_everything_return" do
1465
1490
  slist = Regress.test_gslist_everything_return
1466
- assert_equal ["1", "2", "3"], slist.to_a
1491
+ slist.must_be :==, ["1", "2", "3"]
1467
1492
  end
1468
1493
 
1469
1494
  it "has a working function #test_gslist_nothing_in" do
@@ -1480,12 +1505,12 @@ describe Regress do
1480
1505
 
1481
1506
  it "has a working function #test_gslist_nothing_return" do
1482
1507
  slist = Regress.test_gslist_nothing_return
1483
- assert_equal ["1", "2", "3"], slist.to_a
1508
+ slist.must_be :==, ["1", "2", "3"]
1484
1509
  end
1485
1510
 
1486
1511
  it "has a working function #test_gslist_nothing_return2" do
1487
1512
  slist = Regress.test_gslist_nothing_return2
1488
- assert_equal ["1", "2", "3"], slist.to_a
1513
+ slist.must_be :==, ["1", "2", "3"]
1489
1514
  end
1490
1515
 
1491
1516
  it "has a working function #test_gslist_null_in" do
@@ -1630,27 +1655,27 @@ describe Regress do
1630
1655
 
1631
1656
  it "has a working function #test_strv_in_gvalue" do
1632
1657
  gv = Regress.test_strv_in_gvalue
1633
- assert_equal ['one', 'two', 'three'], gv.get_value.to_a
1658
+ gv.get_value.must_be :==, ['one', 'two', 'three']
1634
1659
  end
1635
1660
 
1636
1661
  it "has a working function #test_strv_out" do
1637
1662
  arr = Regress.test_strv_out
1638
- assert_equal ["thanks", "for", "all", "the", "fish"], arr.to_a
1663
+ arr.must_be :==, ["thanks", "for", "all", "the", "fish"]
1639
1664
  end
1640
1665
 
1641
1666
  it "has a working function #test_strv_out_c" do
1642
1667
  arr = Regress.test_strv_out_c
1643
- assert_equal ["thanks", "for", "all", "the", "fish"], arr.to_a
1668
+ arr.must_be :==, ["thanks", "for", "all", "the", "fish"]
1644
1669
  end
1645
1670
 
1646
1671
  it "has a working function #test_strv_out_container" do
1647
1672
  arr = Regress.test_strv_out_container
1648
- assert_equal ['1', '2', '3'], arr.to_a
1673
+ arr.must_be :==, ['1', '2', '3']
1649
1674
  end
1650
1675
 
1651
1676
  it "has a working function #test_strv_outarg" do
1652
1677
  arr = Regress.test_strv_outarg
1653
- assert_equal ['1', '2', '3'], arr.to_a
1678
+ arr.must_be :==, ['1', '2', '3']
1654
1679
  end
1655
1680
 
1656
1681
  it "has a working function #test_timet" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-30 00:00:00.000000000 Z
12
+ date: 2013-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -91,22 +91,6 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: 10.0.3
94
- - !ruby/object:Gem::Dependency
95
- name: pry
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
94
  description:
111
95
  email:
112
96
  - matijs@matijs.net
@@ -267,6 +251,7 @@ files:
267
251
  - test/gir_ffi/callback_test.rb
268
252
  - test/gir_ffi/base_argument_builder_test.rb
269
253
  - test/gir_ffi/class_base_test.rb
254
+ - test/gir_ffi/type_map_test.rb
270
255
  - test/gir_ffi/argument_builder_test.rb
271
256
  - test/gir_ffi/return_value_builder_test.rb
272
257
  - test/gir_ffi/user_defined_type_info_test.rb
@@ -277,6 +262,7 @@ files:
277
262
  - test/gir_ffi/info_ext/i_signal_info_test.rb
278
263
  - test/gir_ffi/info_ext/safe_constant_name_test.rb
279
264
  - test/gir_ffi/info_ext/safe_function_name_test.rb
265
+ - test/gir_ffi/info_ext/i_object_info_test.rb
280
266
  - test/gir_ffi/info_ext/i_field_info_test.rb
281
267
  - test/gir_ffi/info_ext/i_function_info_test.rb
282
268
  - test/gir_ffi/interface_base_test.rb
@@ -296,6 +282,7 @@ files:
296
282
  - test/ffi-glib/ruby_closure_test.rb
297
283
  - test/ffi-glib/variant_test.rb
298
284
  - test/ffi-glib/sized_array_test.rb
285
+ - test/ffi-glib/strv_test.rb
299
286
  - test/ffi-gobject_introspection/i_repository_test.rb
300
287
  - test/ffi-gobject_introspection/i_constant_info_test.rb
301
288
  - test/ffi-gobject_introspection/i_base_info_test.rb
@@ -356,6 +343,7 @@ test_files:
356
343
  - test/ffi-glib/ruby_closure_test.rb
357
344
  - test/ffi-glib/s_list_test.rb
358
345
  - test/ffi-glib/sized_array_test.rb
346
+ - test/ffi-glib/strv_test.rb
359
347
  - test/ffi-glib/variant_test.rb
360
348
  - test/ffi-gobject/gobject_test.rb
361
349
  - test/ffi-gobject/object_class_test.rb
@@ -395,6 +383,7 @@ test_files:
395
383
  - test/gir_ffi/info_ext/i_callable_info_test.rb
396
384
  - test/gir_ffi/info_ext/i_field_info_test.rb
397
385
  - test/gir_ffi/info_ext/i_function_info_test.rb
386
+ - test/gir_ffi/info_ext/i_object_info_test.rb
398
387
  - test/gir_ffi/info_ext/i_signal_info_test.rb
399
388
  - test/gir_ffi/info_ext/i_type_info_test.rb
400
389
  - test/gir_ffi/info_ext/safe_constant_name_test.rb
@@ -402,6 +391,7 @@ test_files:
402
391
  - test/gir_ffi/interface_base_test.rb
403
392
  - test/gir_ffi/object_base_test.rb
404
393
  - test/gir_ffi/return_value_builder_test.rb
394
+ - test/gir_ffi/type_map_test.rb
405
395
  - test/gir_ffi/unintrospectable_type_info_test.rb
406
396
  - test/gir_ffi/user_defined_property_info_test.rb
407
397
  - test/gir_ffi/user_defined_type_info_test.rb