From bd7cf1485b7421d718c61430a5435d8feef0ac0a Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Mon, 20 Jul 2026 12:40:48 -0400 Subject: [PATCH] Silence Ruby native capability queries Client: rb Co-Authored-By: OpenAI Codex (GPT-5.6) --- lib/rb/lib/thrift/protocol/base_protocol.rb | 1 - lib/rb/spec/base_protocol_spec.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/rb/lib/thrift/protocol/base_protocol.rb b/lib/rb/lib/thrift/protocol/base_protocol.rb index 2a13b692ec8..b91defd8efa 100644 --- a/lib/rb/lib/thrift/protocol/base_protocol.rb +++ b/lib/rb/lib/thrift/protocol/base_protocol.rb @@ -49,7 +49,6 @@ def initialize(trans) end def native? - puts "wrong method is being called!" false end diff --git a/lib/rb/spec/base_protocol_spec.rb b/lib/rb/spec/base_protocol_spec.rb index aa4ace0d852..29eb4295610 100644 --- a/lib/rb/spec/base_protocol_spec.rb +++ b/lib/rb/spec/base_protocol_spec.rb @@ -38,6 +38,18 @@ expect(@prot.trans).to eql(@trans) end + it "should report native capability without writing to stdout or stderr" do + binary = Thrift::BinaryProtocol.new(Thrift::MemoryBufferTransport.new) + compact = Thrift::CompactProtocol.new(Thrift::MemoryBufferTransport.new) + expected_compact_native = defined?(Thrift::BinaryProtocolAccelerated) ? true : false + + expect do + expect(@prot.native?).to be(false) + expect(binary.native?).to be(false) + expect(compact.native?).to eq(expected_compact_native) + end.to output("").to_stdout.and output("").to_stderr + end + it 'should write out a field nicely (deprecated write_field signature)' do expect(@prot).to receive(:write_field_begin).with('field', 'type', 'fid').ordered expect(@prot).to receive(:write_type).with({:name => 'field', :type => 'type'}, 'value').ordered