Skip to content

Commit

Permalink
Rails2.7 segfaults (protocolbuffers#7091)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ewalk153 committed Apr 17, 2020
1 parent 64f6c59 commit 2c8364b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ruby/tests/common_tests.rb
Expand Up @@ -1739,7 +1739,7 @@ def test_freeze
m.freeze

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

Expand Down
1 change: 1 addition & 0 deletions ruby/tests/repeated_field_test.rb
Expand Up @@ -20,6 +20,7 @@ def test_acts_like_an_array
:iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple,
:nitems, :iter_for_reverse_each, :indexes, :append, :prepend]
arr_methods -= [:union, :difference, :filter!]
arr_methods -= [:intersection, :deconstruct] # ruby 2.7 methods we can ignore
arr_methods.each do |method_name|
assert m.repeated_string.respond_to?(method_name) == true, "does not respond to #{method_name}"
end
Expand Down
4 changes: 4 additions & 0 deletions tests.sh
Expand Up @@ -436,6 +436,10 @@ build_ruby26() {
internal_build_cpp # For conformance tests.
cd ruby && bash travis-test.sh ruby-2.6.0 && cd ..
}
build_ruby27() {
internal_build_cpp # For conformance tests.
cd ruby && bash travis-test.sh ruby-2.7.0 && cd ..
}

build_javascript() {
internal_build_cpp
Expand Down

0 comments on commit 2c8364b

Please sign in to comment.