Author: kclark
Date: Tue Jun 17 18:09:28 2008
New Revision: 668960

URL: http://svn.apache.org/viewvc?rev=668960&view=rev
Log:
Improve compatibility with the old Hash-style set.

Fix the integration test for the Set change

Modified:
    incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb
    incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb

Modified: incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb?rev=668960&r1=668959&r2=668960&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb (original)
+++ incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb Tue Jun 17 18:09:28 2008
@@ -1,3 +1,5 @@
+require 'set'
+
 module Thrift
   module Struct
     def initialize(d={})
@@ -121,8 +123,8 @@
         oprot.write_list_end
       elsif field[:type] == Types::SET
         oprot.write_set_begin(field[:element][:type], value.size)
-        value.each do |k, v|
-          write_data(oprot, k, field[:element])
+        value.each do |v,| # the , is to preserve compatibility with the old 
Hash-style sets
+          write_data(oprot, v, field[:element])
         end
         oprot.write_set_end
       else

Modified: incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb?rev=668960&r1=668959&r2=668960&view=diff
==============================================================================
--- incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb (original)
+++ incubator/thrift/trunk/test/rb/integration/test_simple_handler.rb Tue Jun 
17 18:09:28 2008
@@ -114,9 +114,9 @@
   end
 
   def test_set
-    val = {1 => true, 2 => true, 3 => true}
-    assert_equal(@client.testSet(val), val)
-    assert_kind_of(Hash, @client.testSet(val))
+    val = Set.new([1, 2, 3])
+    assert_equal(val, @client.testSet(val))
+    assert_kind_of(Set, @client.testSet(val))
   end
 
   def get_struct


Reply via email to