rice 4.5.0 → 4.6.0

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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/CMakeLists.txt +31 -0
  4. data/CMakePresets.json +75 -0
  5. data/COPYING +3 -2
  6. data/FindRuby.cmake +437 -0
  7. data/Rakefile +5 -4
  8. data/include/rice/rice.hpp +5436 -3201
  9. data/include/rice/stl.hpp +2355 -1269
  10. data/lib/make_rice_headers.rb +79 -0
  11. data/lib/mkmf-rice.rb +4 -0
  12. data/lib/rice/version.rb +3 -0
  13. data/lib/rice.rb +1 -0
  14. data/lib/rubygems/builder.rb +11 -0
  15. data/lib/rubygems/cmake_builder.rb +113 -0
  16. data/lib/rubygems_plugin.rb +9 -0
  17. data/rice/Arg.hpp +7 -1
  18. data/rice/Arg.ipp +11 -2
  19. data/rice/Buffer.hpp +123 -0
  20. data/rice/Buffer.ipp +599 -0
  21. data/rice/Constructor.ipp +3 -3
  22. data/rice/Data_Object.hpp +2 -3
  23. data/rice/Data_Object.ipp +188 -188
  24. data/rice/Data_Type.hpp +4 -5
  25. data/rice/Data_Type.ipp +42 -26
  26. data/rice/Enum.hpp +0 -1
  27. data/rice/Enum.ipp +26 -23
  28. data/rice/Init.hpp +8 -0
  29. data/rice/Init.ipp +8 -0
  30. data/rice/MemoryView.ipp +1 -41
  31. data/rice/Return.hpp +1 -1
  32. data/rice/Return.ipp +6 -0
  33. data/rice/cpp_api/Array.hpp +209 -0
  34. data/rice/cpp_api/Array.ipp +304 -0
  35. data/rice/cpp_api/Builtin_Object.hpp +31 -0
  36. data/rice/cpp_api/Builtin_Object.ipp +37 -0
  37. data/rice/cpp_api/Class.hpp +70 -0
  38. data/rice/cpp_api/Class.ipp +97 -0
  39. data/rice/cpp_api/Encoding.hpp +32 -0
  40. data/rice/cpp_api/Encoding.ipp +59 -0
  41. data/rice/cpp_api/Hash.hpp +194 -0
  42. data/rice/cpp_api/Hash.ipp +257 -0
  43. data/rice/cpp_api/Identifier.hpp +46 -0
  44. data/rice/cpp_api/Identifier.ipp +31 -0
  45. data/rice/cpp_api/Module.hpp +72 -0
  46. data/rice/cpp_api/Module.ipp +101 -0
  47. data/rice/cpp_api/Object.hpp +272 -0
  48. data/rice/cpp_api/Object.ipp +235 -0
  49. data/rice/cpp_api/String.hpp +74 -0
  50. data/rice/cpp_api/String.ipp +120 -0
  51. data/rice/cpp_api/Struct.hpp +113 -0
  52. data/rice/cpp_api/Struct.ipp +92 -0
  53. data/rice/cpp_api/Symbol.hpp +46 -0
  54. data/rice/cpp_api/Symbol.ipp +93 -0
  55. data/rice/cpp_api/shared_methods.hpp +134 -0
  56. data/rice/detail/MethodInfo.hpp +1 -9
  57. data/rice/detail/MethodInfo.ipp +5 -72
  58. data/rice/detail/Native.hpp +3 -2
  59. data/rice/detail/Native.ipp +32 -4
  60. data/rice/detail/NativeAttributeGet.hpp +3 -2
  61. data/rice/detail/NativeAttributeGet.ipp +8 -2
  62. data/rice/detail/NativeAttributeSet.hpp +3 -2
  63. data/rice/detail/NativeAttributeSet.ipp +8 -2
  64. data/rice/detail/NativeCallbackFFI.ipp +1 -1
  65. data/rice/detail/NativeFunction.hpp +17 -6
  66. data/rice/detail/NativeFunction.ipp +168 -64
  67. data/rice/detail/NativeIterator.hpp +3 -2
  68. data/rice/detail/NativeIterator.ipp +8 -2
  69. data/rice/detail/RubyType.hpp +2 -5
  70. data/rice/detail/RubyType.ipp +50 -5
  71. data/rice/detail/Type.hpp +3 -1
  72. data/rice/detail/Type.ipp +61 -31
  73. data/rice/detail/Wrapper.hpp +68 -33
  74. data/rice/detail/Wrapper.ipp +103 -113
  75. data/rice/detail/from_ruby.hpp +5 -4
  76. data/rice/detail/from_ruby.ipp +737 -365
  77. data/rice/detail/to_ruby.ipp +1092 -186
  78. data/rice/global_function.ipp +1 -1
  79. data/rice/libc/file.hpp +11 -0
  80. data/rice/libc/file.ipp +32 -0
  81. data/rice/rice.hpp +23 -16
  82. data/rice/stl/complex.hpp +6 -0
  83. data/rice/stl/complex.ipp +93 -0
  84. data/rice/stl/exception.hpp +11 -0
  85. data/rice/stl/exception.ipp +29 -0
  86. data/rice/stl/exception_ptr.hpp +6 -0
  87. data/rice/stl/exception_ptr.ipp +27 -0
  88. data/rice/stl/map.hpp +12 -0
  89. data/rice/stl/map.ipp +469 -0
  90. data/rice/stl/monostate.hpp +6 -0
  91. data/rice/stl/monostate.ipp +80 -0
  92. data/rice/stl/multimap.hpp +14 -0
  93. data/rice/stl/multimap.ipp +448 -0
  94. data/rice/stl/optional.hpp +6 -0
  95. data/rice/stl/optional.ipp +118 -0
  96. data/rice/stl/pair.hpp +13 -0
  97. data/rice/stl/pair.ipp +155 -0
  98. data/rice/stl/reference_wrapper.hpp +6 -0
  99. data/rice/stl/reference_wrapper.ipp +41 -0
  100. data/rice/stl/set.hpp +12 -0
  101. data/rice/stl/set.ipp +495 -0
  102. data/rice/stl/shared_ptr.hpp +28 -0
  103. data/rice/stl/shared_ptr.ipp +224 -0
  104. data/rice/stl/string.hpp +6 -0
  105. data/rice/stl/string.ipp +158 -0
  106. data/rice/stl/string_view.hpp +6 -0
  107. data/rice/stl/string_view.ipp +65 -0
  108. data/rice/stl/tuple.hpp +6 -0
  109. data/rice/stl/tuple.ipp +128 -0
  110. data/rice/stl/type_index.hpp +6 -0
  111. data/rice/stl/type_index.ipp +30 -0
  112. data/rice/stl/type_info.hpp +6 -0
  113. data/rice/stl/type_info.ipp +29 -0
  114. data/rice/stl/unique_ptr.hpp +22 -0
  115. data/rice/stl/unique_ptr.ipp +139 -0
  116. data/rice/stl/unordered_map.hpp +12 -0
  117. data/rice/stl/unordered_map.ipp +469 -0
  118. data/rice/stl/variant.hpp +6 -0
  119. data/rice/stl/variant.ipp +242 -0
  120. data/rice/stl/vector.hpp +12 -0
  121. data/rice/stl/vector.ipp +590 -0
  122. data/rice/stl.hpp +7 -3
  123. data/rice/traits/attribute_traits.hpp +26 -0
  124. data/rice/traits/function_traits.hpp +95 -0
  125. data/rice/traits/method_traits.hpp +47 -0
  126. data/rice/traits/rice_traits.hpp +160 -0
  127. data/rice.gemspec +85 -0
  128. data/test/embed_ruby.cpp +3 -0
  129. data/test/ruby/test_multiple_extensions_same_class.rb +14 -14
  130. data/test/test_Array.cpp +6 -3
  131. data/test/test_Attribute.cpp +34 -1
  132. data/test/test_Buffer.cpp +285 -0
  133. data/test/test_Callback.cpp +2 -3
  134. data/test/test_Data_Object.cpp +88 -34
  135. data/test/test_Data_Type.cpp +106 -65
  136. data/test/test_Director.cpp +7 -3
  137. data/test/test_Enum.cpp +5 -2
  138. data/test/test_File.cpp +1 -1
  139. data/test/test_From_Ruby.cpp +181 -114
  140. data/test/test_Iterator.cpp +1 -1
  141. data/test/{test_JumpException.cpp → test_Jump_Exception.cpp} +1 -0
  142. data/test/test_Keep_Alive.cpp +7 -18
  143. data/test/test_Keep_Alive_No_Wrapper.cpp +0 -1
  144. data/test/test_Module.cpp +13 -6
  145. data/test/test_Native_Registry.cpp +0 -1
  146. data/test/test_Overloads.cpp +180 -5
  147. data/test/test_Ownership.cpp +100 -57
  148. data/test/test_Proc.cpp +0 -1
  149. data/test/test_Self.cpp +4 -4
  150. data/test/test_Stl_Map.cpp +37 -39
  151. data/test/test_Stl_Multimap.cpp +693 -0
  152. data/test/test_Stl_Pair.cpp +8 -8
  153. data/test/test_Stl_Reference_Wrapper.cpp +4 -2
  154. data/test/test_Stl_Set.cpp +790 -0
  155. data/test/{test_Stl_SmartPointer.cpp → test_Stl_SharedPtr.cpp} +97 -127
  156. data/test/test_Stl_Tuple.cpp +116 -0
  157. data/test/test_Stl_Type.cpp +1 -1
  158. data/test/test_Stl_UniquePtr.cpp +202 -0
  159. data/test/test_Stl_Unordered_Map.cpp +28 -34
  160. data/test/test_Stl_Variant.cpp +217 -89
  161. data/test/test_Stl_Vector.cpp +209 -83
  162. data/test/test_To_Ruby.cpp +373 -1
  163. data/test/test_Type.cpp +85 -14
  164. data/test/test_global_functions.cpp +17 -4
  165. metadata +94 -10
  166. data/rice/detail/TupleIterator.hpp +0 -14
@@ -1,4 +1,4 @@
1
- #include <assert.h>
1
+ #include <assert.h>
2
2
 
3
3
  #include "unittest.hpp"
4
4
  #include "embed_ruby.hpp"
@@ -19,7 +19,7 @@ TEARDOWN(Data_Type)
19
19
  Rice::detail::Registries::instance.types.clearUnverifiedTypes();
20
20
  rb_gc_start();
21
21
  }
22
- /*
22
+
23
23
  namespace
24
24
  {
25
25
  class MyClass
@@ -77,7 +77,7 @@ namespace
77
77
  std::to_string(f) + ", " + s + ", " + std::string(c) + ")";
78
78
  }
79
79
  };
80
- } // namespace
80
+ }
81
81
 
82
82
  TESTCASE(methods_with_member_pointers)
83
83
  {
@@ -558,8 +558,6 @@ namespace
558
558
 
559
559
  TESTCASE(pointers)
560
560
  {
561
- Class voidClass = define_class<void>("Void");
562
-
563
561
  Class helperClass = define_class<Helper>("Helper")
564
562
  .define_constructor(Constructor<Helper, int>())
565
563
  .define_method("value", &Helper::value);
@@ -593,9 +591,9 @@ TESTCASE(pointers)
593
591
  value = result.call("value");
594
592
  ASSERT_EQUAL(5, detail::From_Ruby<int>().convert(value));
595
593
 
596
- helper = object.call("return_void_helper");
597
- result = object.call("check_void_helper", helper);
598
- ASSERT_EQUAL(Qtrue, result.value());
594
+ helper = object.call("return_void_helper");
595
+ result = object.call("check_void_helper", helper);
596
+ ASSERT_EQUAL(Qtrue, result.value());
599
597
  }
600
598
 
601
599
  namespace
@@ -618,7 +616,7 @@ namespace
618
616
  {
619
617
  BigObject** result = new BigObject*[size];
620
618
 
621
- for (int i = 0; i < size; ++i)
619
+ for (size_t i = 0; i < size; ++i)
622
620
  {
623
621
  result[i] = new BigObject(i + 5);
624
622
  }
@@ -629,7 +627,7 @@ namespace
629
627
  {
630
628
  int result = 0;
631
629
 
632
- for (int i = 0; i < size; i++)
630
+ for (size_t i = 0; i < size; i++)
633
631
  {
634
632
  result += bigObjects[i]->value;
635
633
  }
@@ -640,7 +638,7 @@ namespace
640
638
  {
641
639
  int result = 0;
642
640
 
643
- for (int i = 0; i < size; i++)
641
+ for (size_t i = 0; i < size; i++)
644
642
  {
645
643
  result += bigObjects[i]->value;
646
644
  }
@@ -655,23 +653,35 @@ namespace
655
653
 
656
654
  TESTCASE(pointerToPointer)
657
655
  {
656
+ define_buffer<BigObject*>();
657
+
658
+ Module m = define_module("DataTypePointerToPointer");
659
+
658
660
  Class BigObjectClass = define_class<BigObject>("BigObject")
659
661
  .define_attr("value", &BigObject::value);
660
662
 
661
663
  Class ProcessorClass = define_class<Processor>("ProcessorClass")
662
664
  .define_constructor(Constructor<Processor>())
663
665
  .define_method("create", &Processor::createBigObjects)
664
- .define_method("sum", &Processor::sumBigObjects)
665
- .define_method("sum_const", &Processor::sumBigObjectsConst);
666
+ .define_method("sum", &Processor::sumBigObjects,
667
+ Arg("bigObjects").setArray(), Arg("size"))
668
+ .define_method("sum_const", &Processor::sumBigObjectsConst,
669
+ Arg("bigObjects").setArray(), Arg("size"));
666
670
 
667
- size_t size = 2;
668
- Data_Object<Processor> processor = ProcessorClass.call("new");
669
- Data_Object<BigObject> bigObjects = processor.call("create", size);
671
+ std::string code = R"(count = 2
672
+ processor = ProcessorClass.new
673
+ big_objects = processor.create(count)
674
+ processor.sum(big_objects, count))";
670
675
 
671
- Object result = processor.call("sum", bigObjects, size);
676
+ Object result = m.module_eval(code);
672
677
  ASSERT_EQUAL(11, detail::From_Ruby<int>().convert(result));
673
678
 
674
- result = processor.call("sum_const", bigObjects, size);
679
+ code = R"(count = 2
680
+ processor = ProcessorClass.new
681
+ big_objects = processor.create(count)
682
+ processor.sum_const(big_objects, count))";
683
+
684
+ result = m.module_eval(code);
675
685
  ASSERT_EQUAL(11, detail::From_Ruby<int>().convert(result));
676
686
  }
677
687
 
@@ -743,7 +753,7 @@ TESTCASE(not_defined)
743
753
  ASSERT_EQUAL(message, ex.what())
744
754
  );
745
755
 
746
- m.define_module_function<void(*)(UnknownClass)>("undefined_arg_reference", &undefinedArg);
756
+ m.define_module_function<void(*)(UnknownClass&)>("undefined_arg_reference", &undefinedArg);
747
757
 
748
758
  ASSERT_EXCEPTION_CHECK(
749
759
  Rice::Exception,
@@ -756,52 +766,52 @@ TESTCASE(not_defined)
756
766
  // This actually works because we pass a nullptr
757
767
  m.call("undefined_arg_pointer", nullptr);
758
768
  }
759
- */
760
- namespace
769
+
770
+ namespace RangesTest
761
771
  {
762
- class Range
772
+ class RangeCustom
763
773
  {
764
774
  public:
765
- Range(int x, int y) : x(x), y(y)
775
+ RangeCustom(int x, int y) : x(x), y(y)
766
776
  {
767
777
  }
768
778
 
769
- Range(const Range& other) = default;
779
+ RangeCustom(const RangeCustom& other) = default;
770
780
 
771
781
  int x;
772
782
  int y;
773
783
  };
774
784
 
775
- int sumRangesArray(int size, Range ranges[])
785
+ int sumRangesArray(int size, RangeCustom ranges[])
776
786
  {
777
787
  int result = 0;
778
788
  for (int i = 0; i < size; i++)
779
789
  {
780
- const Range& range = ranges[i];
790
+ const RangeCustom& range = ranges[i];
781
791
  result += range.x + range.y;
782
792
  }
783
793
 
784
794
  return result;
785
795
  }
786
796
 
787
- int sumRanges(int size, const Range* ranges)
797
+ int sumRanges(int size, const RangeCustom* ranges)
788
798
  {
789
799
  int result = 0;
790
800
  for (int i = 0; i < size; i++)
791
801
  {
792
- const Range& range = ranges[i];
802
+ const RangeCustom& range = ranges[i];
793
803
  result += range.x + range.y;
794
804
  }
795
805
 
796
806
  return result;
797
807
  }
798
808
 
799
- int sumRanges(int size, const Range** ranges)
809
+ int sumRanges(int size, const RangeCustom** ranges)
800
810
  {
801
811
  int result = 0;
802
812
  for (int i = 0; i < size; i++)
803
813
  {
804
- const Range* range = ranges[i];
814
+ const RangeCustom* range = ranges[i];
805
815
  result += range->x + range->y;
806
816
  }
807
817
 
@@ -811,22 +821,24 @@ namespace
811
821
 
812
822
  TESTCASE(array_of_ranges)
813
823
  {
814
- Module m = define_module("ArrayOfRanges");
815
-
816
- Class c = define_class_under<Range>(m, "Range")
817
- .define_constructor(Constructor<Range, int, int>())
818
- .define_attr("x", &Range::x)
819
- .define_attr("y", &Range::y);
824
+ define_buffer<RangesTest::RangeCustom>();
820
825
 
821
- m.define_module_function("sum_ranges", sumRangesArray);
826
+ Module m = define_module("CustomRanges");
822
827
 
823
- std::string code = R"(range1 = Range.new(1, 2)
824
- range2 = Range.new(3, 4)
825
- range3 = Range.new(5, 6)
828
+ Class c = define_class_under<RangesTest::RangeCustom>(m, "RangeCustom")
829
+ .define_constructor(Constructor<RangesTest::RangeCustom, int, int>())
830
+ .define_attr("x", &RangesTest::RangeCustom::x)
831
+ .define_attr("y", &RangesTest::RangeCustom::y);
826
832
 
827
- ranges = [range1, range2, range3]
833
+ m.define_module_function("sum_ranges_array", RangesTest::sumRangesArray,
834
+ Arg("size"), Arg("ranges[]").setArray());
828
835
 
829
- sum_ranges(ranges.count, ranges))";
836
+ std::string code = R"(range1 = RangeCustom.new(1, 2)
837
+ range2 = RangeCustom.new(3, 4)
838
+ range3 = RangeCustom.new(5, 6)
839
+
840
+ buffer = Rice::Buffer≺RangesTest꞉꞉RangeCustom≻.new([range1, range2, range3])
841
+ sum_ranges_array(buffer.size, buffer))";
830
842
 
831
843
  Object result = m.module_eval(code);
832
844
  ASSERT_EQUAL(21, detail::From_Ruby<int>().convert(result));
@@ -834,45 +846,74 @@ TESTCASE(array_of_ranges)
834
846
 
835
847
  TESTCASE(pointer_of_ranges)
836
848
  {
837
- Module m = define_module("PointerOfRanges");
849
+ define_buffer<RangesTest::RangeCustom>();
838
850
 
839
- Class c = define_class_under<Range>(m, "Range")
840
- .define_constructor(Constructor<Range, int, int>())
841
- .define_attr("x", &Range::x)
842
- .define_attr("y", &Range::y);
851
+ Module m = define_module("CustomRanges");
843
852
 
844
- m.define_module_function<int(*)(int, const Range*)>("sum_ranges", sumRanges);
853
+ Class c = define_class_under<RangesTest::RangeCustom>(m, "RangeCustom")
854
+ .define_constructor(Constructor<RangesTest::RangeCustom, int, int>())
855
+ .define_attr("x", &RangesTest::RangeCustom::x)
856
+ .define_attr("y", &RangesTest::RangeCustom::y);
845
857
 
846
- std::string code = R"(range1 = Range.new(1, 2)
847
- range2 = Range.new(3, 4)
848
- range3 = Range.new(5, 6)
858
+ m.define_module_function<int(*)(int, const RangesTest::RangeCustom*)>("sum_ranges", RangesTest::sumRanges,
859
+ Arg("size"), Arg("ranges*").setArray());
849
860
 
850
- ranges = [range1, range2, range3]
861
+ std::string code = R"(range1 = RangeCustom.new(1, 2)
862
+ range2 = RangeCustom.new(3, 4)
863
+ range3 = RangeCustom.new(5, 6)
851
864
 
852
- sum_ranges(ranges.count, ranges))";
865
+ buffer = Rice::Buffer≺RangesTest꞉꞉RangeCustom≻.new([range1, range2, range3])
866
+ sum_ranges(buffer.size, buffer))";
853
867
 
854
868
  Object result = m.module_eval(code);
855
869
  ASSERT_EQUAL(21, detail::From_Ruby<int>().convert(result));
856
870
  }
857
871
 
858
- TESTCASE(pointer_of_pointer_ranges)
872
+ TESTCASE(pointer_of_ranges_wrong)
859
873
  {
860
- Module m = define_module("PointerOfPointersOfRanges");
874
+ define_buffer<RangesTest::RangeCustom>();
861
875
 
862
- Class c = define_class_under<Range>(m, "Range")
863
- .define_constructor(Constructor<Range, int, int>())
864
- .define_attr("x", &Range::x)
865
- .define_attr("y", &Range::y);
876
+ Module m = define_module("CustomRanges");
877
+
878
+ Class c = define_class_under<RangesTest::RangeCustom>(m, "RangeCustom")
879
+ .define_constructor(Constructor<RangesTest::RangeCustom, int, int>())
880
+ .define_attr("x", &RangesTest::RangeCustom::x)
881
+ .define_attr("y", &RangesTest::RangeCustom::y);
882
+
883
+ m.define_module_function<int(*)(int, const RangesTest::RangeCustom*)>("sum_ranges_wrong", RangesTest::sumRanges);
884
+
885
+ std::string code = R"(range1 = RangeCustom.new(1, 2)
886
+ range2 = RangeCustom.new(3, 4)
887
+ range3 = RangeCustom.new(5, 6)
888
+
889
+ buffer = Rice::Buffer≺RangesTest꞉꞉RangeCustom≻.new([range1, range2, range3])
890
+ sum_ranges_wrong(buffer.size, buffer))";
891
+
892
+ ASSERT_EXCEPTION_CHECK(
893
+ Rice::Exception,
894
+ m.module_eval(code),
895
+ ASSERT_EQUAL("wrong argument type Rice::Buffer≺RangesTest꞉꞉RangeCustom≻ (expected CustomRanges::RangeCustom)", ex.what())
896
+ );
897
+ }
898
+
899
+ TESTCASE(pointer_of_pointer_ranges)
900
+ {
901
+ define_buffer<RangesTest::RangeCustom*>();
866
902
 
867
- m.define_module_function<int(*)(int, const Range**)>("sum_ranges", sumRanges);
903
+ Module m = define_module("CustomRanges");
868
904
 
869
- std::string code = R"(range1 = Range.new(1, 2)
870
- range2 = Range.new(3, 4)
871
- range3 = Range.new(5, 6)
905
+ Class c = define_class_under<RangesTest::RangeCustom>(m, "RangeCustom")
906
+ .define_constructor(Constructor<RangesTest::RangeCustom, int, int>())
907
+ .define_attr("x", &RangesTest::RangeCustom::x)
908
+ .define_attr("y", &RangesTest::RangeCustom::y);
872
909
 
873
- ranges = [range1, range2, range3]
910
+ m.define_module_function<int(*)(int, const RangesTest::RangeCustom**)>("sum_ranges", RangesTest::sumRanges);
874
911
 
875
- sum_ranges(ranges.count, ranges))";
912
+ std::string code = R"(range1 = RangeCustom.new(1, 2)
913
+ range2 = RangeCustom.new(3, 4)
914
+ range3 = RangeCustom.new(5, 6)
915
+ buffer = Rice::Buffer≺RangesTest꞉꞉RangeCustom≻.new([range1, range2, range3])
916
+ sum_ranges(buffer.size, buffer))";
876
917
 
877
918
  Object result = m.module_eval(code);
878
919
  ASSERT_EQUAL(21, detail::From_Ruby<int>().convert(result));
@@ -196,11 +196,15 @@ TESTCASE(polymorphic_calls_head_down_the_call_chain)
196
196
 
197
197
  namespace {
198
198
 
199
- class CallsSelf {
199
+ class CallsSelf
200
+ {
200
201
  public:
201
- virtual ~CallsSelf() { }
202
+ virtual ~CallsSelf()
203
+ {
204
+ }
202
205
 
203
- int doIt(int in) {
206
+ int doIt(int in)
207
+ {
204
208
  return doItImpl(in);
205
209
  }
206
210
 
data/test/test_Enum.cpp CHANGED
@@ -20,7 +20,6 @@ TEARDOWN(Enum)
20
20
  rb_gc_start();
21
21
  }
22
22
 
23
-
24
23
  namespace
25
24
  {
26
25
  enum Color { RED, BLACK, GREEN };
@@ -164,7 +163,11 @@ TESTCASE(bitset_operators)
164
163
  Object value = m.module_eval(code);
165
164
  ASSERT_EQUAL(1, detail::From_Ruby<int>().convert(value));
166
165
 
167
- code = R"(Season::Summer | Season::Fall)";
166
+ code = R"(Season::Spring | Season::Summer)";
167
+ value = m.module_eval(code);
168
+ ASSERT_EQUAL(1, detail::From_Ruby<int>().convert(value));
169
+
170
+ code = R"(Season::Spring | Season::Summer | Season::Fall)";
168
171
  value = m.module_eval(code);
169
172
  ASSERT_EQUAL(3, detail::From_Ruby<int>().convert(value));
170
173
 
data/test/test_File.cpp CHANGED
@@ -25,7 +25,7 @@ namespace
25
25
  FILE* openFile()
26
26
  {
27
27
  std::filesystem::path path = __FILE__;
28
- FILE* fptr = fopen(path.u8string().c_str(), "rb");
28
+ FILE* fptr = fopen(path.string().c_str(), "rb");
29
29
  return fptr;
30
30
  }
31
31