<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,25 +16,29 @@ class MemcachedTest &lt; Test::Unit::TestCase
     @options = {
       :prefix_key =&gt; @prefix_key,
       :hash =&gt; :default,
-      :distribution =&gt; :modula
-    }
+      :distribution =&gt; :modula}
     @cache = Memcached.new(@servers, @options)
+    
+    @binary_protocol_options = {
+      :prefix_key =&gt; @prefix_key,
+      :hash =&gt; :default,
+      :distribution =&gt; :modula,
+      :binary_protocol =&gt; true}
+    @binary_protocol_cache = Memcached.new(@servers, @binary_protocol_options)
 
     @udp_options = {
       :prefix_key =&gt; @prefix_key,
       :hash =&gt; :default,
       :use_udp =&gt; true,
-      :distribution =&gt; :modula
-    }
+      :distribution =&gt; :modula}
     @udp_cache = Memcached.new(@udp_servers, @udp_options)
 
-    @nb_options = {
+    @noblock_options = {
       :prefix_key =&gt; @prefix_key,
       :no_block =&gt; true,
       :buffer_requests =&gt; true,
-      :hash =&gt; :default
-    }
-    @nb_cache = Memcached.new(@servers, @nb_options)
+      :hash =&gt; :default}
+    @noblock_cache = Memcached.new(@servers, @noblock_options)
 
     @value = OpenStruct.new(:a =&gt; 1, :b =&gt; 2, :c =&gt; GenericClass)
     @marshalled_value = Marshal.dump(@value)
@@ -85,8 +89,8 @@ class MemcachedTest &lt; Test::Unit::TestCase
   end
 
   def test_options_are_set
-    Memcached::DEFAULTS.merge(@nb_options).each do |key, expected|
-      value = @nb_cache.options[key]
+    Memcached::DEFAULTS.merge(@noblock_options).each do |key, expected|
+      value = @noblock_cache.options[key]
       unless key == :rcv_timeout or key == :poll_timeout
         assert(expected == value, &quot;#{key} should be #{expected} but was #{value}&quot;)
       end
@@ -111,15 +115,6 @@ class MemcachedTest &lt; Test::Unit::TestCase
     assert_raise(ArgumentError) { Memcached.new &quot;local host:43043:1&quot; }
   end
 
-#  def test_initialize_with_resolvable_hosts
-#    host = `hostname`.chomp
-#    cache = Memcached.new(&quot;#{host}:43042&quot;)
-#    assert_equal host, cache.send(:server_structs).first.hostname
-#
-#    cache.set(key, @value)
-#    assert_equal @value, cache.get(key)
-#  end
-
   def test_initialize_with_invalid_options
     assert_raise(ArgumentError) do
       Memcached.new @servers, :sort_hosts =&gt; true, :distribution =&gt; :consistent
@@ -223,9 +218,11 @@ class MemcachedTest &lt; Test::Unit::TestCase
     @cache.set key, @value
     result = @cache.get key
     assert_equal @value, result
-  end
 
-  def test_udp_get
+    @binary_protocol_cache.set key, @value
+    result = @binary_protocol_cache.get key
+    assert_equal @value, result
+
     @udp_cache.set(key, @value)
     assert_raises(Memcached::ActionNotSupported) do
       @udp_cache.get(key)
@@ -410,9 +407,11 @@ class MemcachedTest &lt; Test::Unit::TestCase
     assert_nothing_raised do
       @cache.set(key, @value)
     end
-  end
+    
+    assert_nothing_raised do
+      @binary_protocol_cache.set(key, @value)
+    end
 
-  def test_udp_set
     assert_nothing_raised do
       @udp_cache.set(key, @value)
     end
@@ -571,6 +570,12 @@ class MemcachedTest &lt; Test::Unit::TestCase
       @cache.append key, &quot;end&quot;
     end
     assert_equal &quot;startend&quot;, @cache.get(key, false)
+
+    @binary_protocol_cache.set key, &quot;start&quot;, 0, false
+    assert_nothing_raised do
+      @binary_protocol_cache.append key, &quot;end&quot;
+    end
+    assert_equal &quot;startend&quot;, @binary_protocol_cache.get(key, false)
   end
 
   def test_missing_append
@@ -581,6 +586,14 @@ class MemcachedTest &lt; Test::Unit::TestCase
     assert_raise(Memcached::NotFound) do
       assert_equal @value, @cache.get(key)
     end
+
+    @binary_protocol_cache.delete key rescue nil
+    assert_raise(Memcached::NotStored) do
+      @binary_protocol_cache.append key, &quot;end&quot;
+    end
+    assert_raise(Memcached::NotFound) do
+      assert_equal @value, @binary_protocol_cache.get(key)
+    end
   end
 
   def test_prepend
@@ -753,10 +766,10 @@ class MemcachedTest &lt; Test::Unit::TestCase
 
   def test_no_block_return_value
     assert_nothing_raised do
-      @nb_cache.set key, @value
+      @noblock_cache.set key, @value
     end
     ret = Rlibmemcached.memcached_set(
-      @nb_cache.instance_variable_get(&quot;@struct&quot;),
+      @noblock_cache.instance_variable_get(&quot;@struct&quot;),
       key,
       @marshalled_value,
       0,
@@ -766,35 +779,35 @@ class MemcachedTest &lt; Test::Unit::TestCase
   end
   
   def test_no_block_get
-    @nb_cache.set key, @value
+    @noblock_cache.set key, @value
     assert_equal @value, 
-      @nb_cache.get(key)
+      @noblock_cache.get(key)
   end
 
   def test_no_block_missing_delete
-    @nb_cache.delete key rescue nil
+    @noblock_cache.delete key rescue nil
     assert_nothing_raised do
-      @nb_cache.delete key
+      @noblock_cache.delete key
     end
   end
 
   def test_no_block_set_invalid_key
     assert_raises(Memcached::ABadKeyWasProvidedOrCharactersOutOfRange) do
-      @nb_cache.set &quot;I'm so bad&quot;, @value
+      @noblock_cache.set &quot;I'm so bad&quot;, @value
     end
   end
 
   def test_no_block_set_object_too_large
     assert_nothing_raised do
-      @nb_cache.set key, &quot;I'm big&quot; * 1000000
+      @noblock_cache.set key, &quot;I'm big&quot; * 1000000
     end
   end
 
   def test_no_block_existing_add
     # Should still raise
-    @nb_cache.set key, @value
+    @noblock_cache.set key, @value
     assert_raise(Memcached::NotStored) do
-      @nb_cache.add key, @value
+      @noblock_cache.add key, @value
     end
   end
 </diff>
      <filename>test/unit/memcached_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>44b4e3191674a47cd5f7bec533b9401b6195f476</id>
    </parent>
  </parents>
  <author>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </author>
  <url>http://github.com/chriseppstein/memcached/commit/2db883517c1b352f57f138c4be4edd5ec3d308b0</url>
  <id>2db883517c1b352f57f138c4be4edd5ec3d308b0</id>
  <committed-date>2009-09-21T14:21:54-07:00</committed-date>
  <authored-date>2009-09-21T14:21:54-07:00</authored-date>
  <message>Additional tests for binary protocol.</message>
  <tree>aa479e4cbb8e3b3ecb2eff8b2e59f3dd10d6f48e</tree>
  <committer>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </committer>
</commit>
