Apache Solr open-source search software
adjust tests to work without libxml2
Erik Hatchera74e62d8c34a
diff --git a/client/ruby/solr-ruby/test/unit/document_test.rb b/client/ruby/solr-ruby/test/unit/document_test.rbindex 758834c479f..16d0712f288 100644--- a/client/ruby/solr-ruby/test/unit/document_test.rb+++ b/client/ruby/solr-ruby/test/unit/document_test.rb@@ -59,7 +59,7 @@ class DocumentTest < Test::Unit::TestCasedef test_boostdoc = Solr::Document.new :name => "McGrump"doc.boost = 300.28- assert_match(/<doc boost=['"]300.28['"]>[\s]+<field name=['"]name['"]>McGrump<\/field>[\s]+<\/doc>/, doc.to_xml.to_s)+ assert_match(/<doc boost=['"]300.28['"]>[\s]*<field name=['"]name['"]>McGrump<\/field>[\s]*<\/doc>/, doc.to_xml.to_s)endenddiff --git a/client/ruby/solr-ruby/test/unit/request_test.rb b/client/ruby/solr-ruby/test/unit/request_test.rbindex dd4ef903398..ca2e5897a16 100755--- a/client/ruby/solr-ruby/test/unit/request_test.rb+++ b/client/ruby/solr-ruby/test/unit/request_test.rb@@ -22,7 +22,7 @@ class RequestTest < Test::Unit::TestCaserequest = Solr::Request::Commit.newassert_equal :xml, request.response_formatassert_equal 'update', request.handler- assert_equal '<commit waitSearcher="true" waitFlush="true"/>', request.to_s+ assert_match(/<commit waitSearcher=["']true["'] waitFlush=["'']true["'']\/>/, request.to_s)enddef test_add_doc_requestdiff --git a/client/ruby/solr-ruby/test/unit/xpath_mapper_test.rb b/client/ruby/solr-ruby/test/unit/xpath_mapper_test.rbindex 70a200c27e4..6d364c9e92e 100755--- a/client/ruby/solr-ruby/test/unit/xpath_mapper_test.rb+++ b/client/ruby/solr-ruby/test/unit/xpath_mapper_test.rb@@ -10,24 +10,29 @@# See the License for the specific language governing permissions and# limitations under the License.-require 'solr'-require 'test/unit'+begin+ require 'solr'+ require 'test/unit'+ require 'xml/libxml'-class XPathMapperTest < Test::Unit::TestCase+ class XPathMapperTest < Test::Unit::TestCase- def setup- @doc = XML::Document.file(File.expand_path(File.dirname(__FILE__)) + "/xpath_test_file.xml")- end+ def setup+ @doc = XML::Document.file(File.expand_path(File.dirname(__FILE__)) + "/xpath_test_file.xml")+ end- def test_simple_xpath- mapping = {:solr_field1 => :'/root/parent/child',- :solr_field2 => :'/root/parent/child/@attribute'}+ def test_simple_xpath+ mapping = {:solr_field1 => :'/root/parent/child',+ :solr_field2 => :'/root/parent/child/@attribute'}- mapper = Solr::Importer::XPathMapper.new(mapping)- mapped_data = mapper.map(@doc)+ mapper = Solr::Importer::XPathMapper.new(mapping)+ mapped_data = mapper.map(@doc)- assert_equal ['text1', 'text2'], mapped_data[:solr_field1]- assert_equal ['attribute1', 'attribute2'], mapped_data[:solr_field2]- end+ assert_equal ['text1', 'text2'], mapped_data[:solr_field1]+ assert_equal ['attribute1', 'attribute2'], mapped_data[:solr_field2]+ end-end+ end+rescue LoadError => e+ puts "XPathMapperTest not run because #{e}"+end\ No newline at end of file