class TestXMLShim

Public Instance Methods

test_escape_string_with_nokogiri() click to toggle source
# File test/test_xml_shim.rb, line 12
def test_escape_string_with_nokogiri
  Splunk::require_xml_library(:nokogiri)
  assert_equal("&lt;&gt;'\"&amp;", Splunk::escape_string("<>'\"&"))
end
test_escape_string_with_rexml() click to toggle source
# File test/test_xml_shim.rb, line 7
def test_escape_string_with_rexml
  Splunk::require_xml_library(:rexml)
  assert_equal("&lt;&gt;'\"&amp;", Splunk::escape_string("<>'\"&"))
end
test_matches_with_nokogiri() click to toggle source
# File test/test_xml_shim.rb, line 27
def test_matches_with_nokogiri
  Splunk::require_xml_library(:nokogiri)
  m = Splunk::text_at_xpath("//msg", "<response><msg>Boris &amp; Natasha</msg></response>")
  assert_equal("Boris & Natasha", m)
end
test_matches_with_rexml() click to toggle source
# File test/test_xml_shim.rb, line 33
def test_matches_with_rexml
  Splunk::require_xml_library(:rexml)
  m = Splunk::text_at_xpath("//msg", "<response><msg>Boris &amp; Natasha</msg></response>")
  assert_equal("Boris & Natasha", m)
end
test_no_matches_with_nokogiri() click to toggle source
# File test/test_xml_shim.rb, line 22
def test_no_matches_with_nokogiri
  Splunk::require_xml_library(:nokogiri)
  assert_nil(Splunk::text_at_xpath("//msg", "<html>Hi</html>"))
end
test_no_matches_with_rexml() click to toggle source
# File test/test_xml_shim.rb, line 17
def test_no_matches_with_rexml
  Splunk::require_xml_library(:rexml)
  assert_nil(Splunk::text_at_xpath("//msg", "<html>Hi</html>"))
end