From d0fc2794c4333c43d2a166ebac6b56da872eff50 Mon Sep 17 00:00:00 2001 From: Jason Lunn Date: Mon, 28 Mar 2022 19:00:18 -0400 Subject: [PATCH] Cleanup warnings seen when running tests. --- ruby/tests/repeated_field_test.rb | 35 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/ruby/tests/repeated_field_test.rb b/ruby/tests/repeated_field_test.rb index 7ffc0f1801..6ad39b5563 100755 --- a/ruby/tests/repeated_field_test.rb +++ b/ruby/tests/repeated_field_test.rb @@ -36,13 +36,13 @@ class RepeatedFieldTest < Test::Unit::TestCase end fill_test_msg(m) - assert_equal -10, m.repeated_int32.first - assert_equal -1_000_000, m.repeated_int64.first + assert_equal( -10, m.repeated_int32.first ) + assert_equal( -1_000_000, m.repeated_int64.first ) assert_equal 10, m.repeated_uint32.first assert_equal 1_000_000, m.repeated_uint64.first assert_equal true, m.repeated_bool.first - assert_equal -1.01, m.repeated_float.first.round(2) - assert_equal -1.0000000000001, m.repeated_double.first + assert_equal( -1.01, m.repeated_float.first.round(2) ) + assert_equal( -1.0000000000001, m.repeated_double.first ) assert_equal 'foo', m.repeated_string.first assert_equal "bar".encode!('ASCII-8BIT'), m.repeated_bytes.first assert_equal TestMessage2.new(:foo => 1), m.repeated_msg.first @@ -61,13 +61,13 @@ class RepeatedFieldTest < Test::Unit::TestCase assert_nil m.send(field_name).first end fill_test_msg(m) - assert_equal -11, m.repeated_int32.last - assert_equal -1_000_001, m.repeated_int64.last + assert_equal( -11, m.repeated_int32.last ) + assert_equal( -1_000_001, m.repeated_int64.last ) assert_equal 11, m.repeated_uint32.last assert_equal 1_000_001, m.repeated_uint64.last assert_equal false, m.repeated_bool.last - assert_equal -1.02, m.repeated_float.last.round(2) - assert_equal -1.0000000000002, m.repeated_double.last + assert_equal( -1.02, m.repeated_float.last.round(2) ) + assert_equal( -1.0000000000002, m.repeated_double.last ) assert_equal 'bar', m.repeated_string.last assert_equal "foo".encode!('ASCII-8BIT'), m.repeated_bytes.last assert_equal TestMessage2.new(:foo => 2), m.repeated_msg.last @@ -82,20 +82,20 @@ class RepeatedFieldTest < Test::Unit::TestCase end fill_test_msg(m) - assert_equal -11, m.repeated_int32.pop - assert_equal -10, m.repeated_int32.pop - assert_equal -1_000_001, m.repeated_int64.pop - assert_equal -1_000_000, m.repeated_int64.pop + assert_equal( -11, m.repeated_int32.pop ) + assert_equal( -10, m.repeated_int32.pop ) + assert_equal( -1_000_001, m.repeated_int64.pop ) + assert_equal( -1_000_000, m.repeated_int64.pop ) assert_equal 11, m.repeated_uint32.pop assert_equal 10, m.repeated_uint32.pop assert_equal 1_000_001, m.repeated_uint64.pop assert_equal 1_000_000, m.repeated_uint64.pop assert_equal false, m.repeated_bool.pop assert_equal true, m.repeated_bool.pop - assert_equal -1.02, m.repeated_float.pop.round(2) - assert_equal -1.01, m.repeated_float.pop.round(2) - assert_equal -1.0000000000002, m.repeated_double.pop - assert_equal -1.0000000000001, m.repeated_double.pop + assert_equal( -1.02, m.repeated_float.pop.round(2) ) + assert_equal( -1.01, m.repeated_float.pop.round(2) ) + assert_equal( -1.0000000000002, m.repeated_double.pop ) + assert_equal( -1.0000000000001, m.repeated_double.pop ) assert_equal 'bar', m.repeated_string.pop assert_equal 'foo', m.repeated_string.pop assert_equal "foo".encode!('ASCII-8BIT'), m.repeated_bytes.pop @@ -487,11 +487,8 @@ class RepeatedFieldTest < Test::Unit::TestCase def test_shuffle! m = TestMessage.new m.repeated_string += %w(foo bar baz) - orig_repeated_string = m.repeated_string.clone result = m.repeated_string.shuffle! assert_equal m.repeated_string, result - # NOTE: sometimes it doesn't change the order... - # assert_not_equal m.repeated_string.to_a, orig_repeated_string.to_a end def test_slice!