File: test_monkey_patch.rb

package info (click to toggle)
ruby-nokogiri 1.18.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 8,076 kB
  • sloc: ansic: 38,893; xml: 27,665; ruby: 27,285; java: 15,348; cpp: 7,107; yacc: 244; sh: 208; makefile: 154; sed: 14
file content (17 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# encoding: utf-8
# frozen_string_literal: true

require "helper"

class TestHtml5SerializationMonkeyPatch < Nokogiri::TestCase
  def test_to_xml
    xml = Nokogiri.HTML5("<!DOCTYPE html><source>").to_xml
    assert_match(/\A<\?xml version/, xml)
    assert_match(%r{<source\s*/>}, xml)
  end

  def test_html4_fragment
    frag = Nokogiri::HTML4.fragment("<span></span>")
    assert_kind_of(Nokogiri::HTML4::DocumentFragment, frag)
  end
end if Nokogiri.uses_gumbo?