Skip to content

Commit 2c8364b

Browse files
authored
Rails2.7 segfaults (protocolbuffers#7091)
* Add a test suite for ruby 2.7 * Call BigDecimal() instead of BigDecimal.new() BigDecimal.new was deprecated in ruby 2.6 * Switch FrozenError expectation to a matcher The error message for FrozenError changed to include more information about the mutated object. Switch from an exact match to an aproximate match (equal => match). This does not change the prefix. * We can safely ignore newest array methods from ruby 2.7
1 parent 64f6c59 commit 2c8364b

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

ruby/tests/common_tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ def test_freeze
17391739
m.freeze
17401740

17411741
frozen_error = assert_raise(FrozenErrorType) { m.optional_int32 = 20 }
1742-
assert_equal "can't modify frozen #{proto_module}::TestMessage", frozen_error.message
1742+
assert_match "can't modify frozen #{proto_module}::TestMessage", frozen_error.message
17431743
assert_equal 10, m.optional_int32
17441744
assert_equal true, m.frozen?
17451745

ruby/tests/repeated_field_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_acts_like_an_array
2020
:iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple,
2121
:nitems, :iter_for_reverse_each, :indexes, :append, :prepend]
2222
arr_methods -= [:union, :difference, :filter!]
23+
arr_methods -= [:intersection, :deconstruct] # ruby 2.7 methods we can ignore
2324
arr_methods.each do |method_name|
2425
assert m.repeated_string.respond_to?(method_name) == true, "does not respond to #{method_name}"
2526
end

tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ build_ruby26() {
436436
internal_build_cpp # For conformance tests.
437437
cd ruby && bash travis-test.sh ruby-2.6.0 && cd ..
438438
}
439+
build_ruby27() {
440+
internal_build_cpp # For conformance tests.
441+
cd ruby && bash travis-test.sh ruby-2.7.0 && cd ..
442+
}
439443

440444
build_javascript() {
441445
internal_build_cpp

0 commit comments

Comments
 (0)