mirror of https://github.com/apache/lucene.git
SOLR-155: Fix field contents escaping (patch provided by Coda Hale)
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@506420 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6b81f79ae9
commit
e5c7e68e40
|
@ -31,7 +31,7 @@ begin
|
|||
|
||||
# element.text = "blah" should work
|
||||
def text=(x)
|
||||
self.content = x.to_s
|
||||
self << x.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@ class FieldTest < Test::Unit::TestCase
|
|||
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 & 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
|
||||
|
|
Loading…
Reference in New Issue