You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_document_fragment.rb
    path of file: ./repos/nokogiri/test/html4
    
    the code of the file until where you have to start completion: # -*- coding: utf-8 -*-
# frozen_string_literal: true

require "helper"

module Nokogiri
    
        def test_to_xhtml
          doc = "<span>foo<br></span><span>bar</span><p></p>"
          fragment = Nokogiri::HTML4::Document.new.fragment(doc)
          if Nokogiri.jruby? || Nokogiri.uses_libxml?(">= 2.7.0")
            assert_equal("<span>foo<br /></span><span>bar</span><p></p>", fragment.to_xhtml)
          else
            # FIXME: why are we doing this ? this violates the spec,
            # see http://www.w3.org/TR/xhtml1/#C_2
            assert_equal("<span>foo<br></span><span>bar</span><p></p>", fragment.to_xhtml)
          end
        end