lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r506420 - in /lucene/solr/trunk/client/ruby/solrb: lib/solr/xml.rb test/unit/field_test.rb
Date Mon, 12 Feb 2007 11:27:02 GMT
Author: ehatcher
Date: Mon Feb 12 03:27:01 2007
New Revision: 506420

URL: http://svn.apache.org/viewvc?view=rev&rev=506420
Log:
SOLR-155: Fix field contents escaping (patch provided by Coda Hale)


Modified:
    lucene/solr/trunk/client/ruby/solrb/lib/solr/xml.rb
    lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb

Modified: lucene/solr/trunk/client/ruby/solrb/lib/solr/xml.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/lib/solr/xml.rb?view=diff&rev=506420&r1=506419&r2=506420
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/lib/solr/xml.rb (original)
+++ lucene/solr/trunk/client/ruby/solrb/lib/solr/xml.rb Mon Feb 12 03:27:01 2007
@@ -31,7 +31,7 @@
 
     # element.text = "blah" should work
     def text=(x)
-      self.content = x.to_s
+      self << x.to_s
     end
   end
   

Modified: lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb?view=diff&rev=506420&r1=506419&r2=506420
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb (original)
+++ lucene/solr/trunk/client/ruby/solrb/test/unit/field_test.rb Mon Feb 12 03:27:01 2007
@@ -21,6 +21,12 @@
     assert_match(/<field name=["']creator["']>Erik Hatcher<\/field>/, field.to_xml.to_s)
   end
   
+  def test_escaped_xml
+    field = Solr::Field.new :creator => 'Erik Hatcher & His Amazing Leaping Ability'
+    assert_kind_of Solr::XML::Element, field.to_xml
+    assert_match(/<field name=["']creator["']>Erik Hatcher &amp; His Amazing Leaping
Ability<\/field>/, field.to_xml.to_s)
+  end
+  
   def test_xml_date
     field = Solr::Field.new :time => Time.now
     assert_kind_of Solr::XML::Element, field.to_xml



Mime
View raw message