File: test_monkey_patch.rb

package info (click to toggle)
ruby-nokogiri 1.13.10%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,416 kB
  • sloc: ansic: 38,198; xml: 28,086; ruby: 22,271; java: 15,517; cpp: 7,037; yacc: 244; sh: 148; makefile: 136
file content (17 lines) | stat: -rw-r--r-- 463 bytes parent folder | download
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::HTML.fragment("<span></span>")
    assert(frag.is_a?(Nokogiri::HTML::DocumentFragment))
  end
end if Nokogiri.uses_gumbo?