This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 497447f3b9a3745baf266d6e4795328ef6745101
Author: Andrew Stitcher <[email protected]>
AuthorDate: Tue Jul 21 02:16:31 2026 -0400

    PROTON-2946: Fix interop round trip comparision for ruby tests
    
    - Previous fix was only for python tests
---
 ruby/tests/test_interop.rb | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/ruby/tests/test_interop.rb b/ruby/tests/test_interop.rb
index 58e6b58ff..b95a3ca48 100755
--- a/ruby/tests/test_interop.rb
+++ b/ruby/tests/test_interop.rb
@@ -35,9 +35,33 @@ class InteropTest < Minitest::Test
       buffer = buffer[n..-1]
     end
     @data.rewind
+
+    # Verify semantic round-trip: decode the re-encoded bytes and compare
+    # object contents.  Byte-for-byte equality is not required because the
+    # encoder may legitimately choose a more compact encoding (e.g. LIST8
+    # instead of LIST32) that is semantically identical.
     reencoded = @data.encode
-    # Test the round-trip re-encoding gives the same result.
-    assert_equal(encoded, reencoded)
+    reencoded_data = Codec::Data.new
+    buffer = reencoded
+    while buffer.size > 0
+      n = reencoded_data.decode(buffer)
+      buffer = buffer[n..-1]
+    end
+    reencoded_data.rewind
+
+    # Compare all objects in both data
+    original_objects = []
+    while @data.next
+      original_objects << @data.object
+    end
+    @data.rewind
+
+    reencoded_objects = []
+    while reencoded_data.next
+      reencoded_objects << reencoded_data.object
+    end
+
+    assert_equal(original_objects, reencoded_objects)
   end
 
   def decode_data_file(name) decode_data(get_data(name)); end


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to