From 2c8364bcd199f4ce98892be10cafd7d3e537c0eb Mon Sep 17 00:00:00 2001 From: Eric Walker Date: Fri, 17 Apr 2020 13:20:38 -0400 Subject: [PATCH] Rails2.7 segfaults (#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 --- ruby/tests/common_tests.rb | 2 +- ruby/tests/repeated_field_test.rb | 1 + tests.sh | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ruby/tests/common_tests.rb b/ruby/tests/common_tests.rb index 67781467a1..1f5013a529 100644 --- a/ruby/tests/common_tests.rb +++ b/ruby/tests/common_tests.rb @@ -1739,7 +1739,7 @@ module CommonTests 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? diff --git a/ruby/tests/repeated_field_test.rb b/ruby/tests/repeated_field_test.rb index ced9de8381..6307447bc3 100755 --- a/ruby/tests/repeated_field_test.rb +++ b/ruby/tests/repeated_field_test.rb @@ -20,6 +20,7 @@ class RepeatedFieldTest < Test::Unit::TestCase :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 diff --git a/tests.sh b/tests.sh index 9f485fee09..84fb0b124b 100755 --- a/tests.sh +++ b/tests.sh @@ -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