Specs for parsing various empty nodes.
This commit is contained in:
parent
cb74c7edf9
commit
10d0ec1573
|
@ -2,6 +2,10 @@ require 'spec_helper'
|
|||
|
||||
describe Oga::XML::Parser do
|
||||
context 'cdata tags' do
|
||||
example 'parse an empty cdata tag' do
|
||||
parse('<![CDATA[]]>').should == s(:document, s(:cdata))
|
||||
end
|
||||
|
||||
example 'parse a cdata tag' do
|
||||
parse('<![CDATA[foo]]>').should == s(:document, s(:cdata, 'foo'))
|
||||
end
|
||||
|
|
|
@ -2,6 +2,10 @@ require 'spec_helper'
|
|||
|
||||
describe Oga::XML::Parser do
|
||||
context 'HTML documents' do
|
||||
example 'parse an empty document' do
|
||||
parse('').should == s(:document)
|
||||
end
|
||||
|
||||
example 'parse a basic HTML document' do
|
||||
html = <<-EOF
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -2,7 +2,11 @@ require 'spec_helper'
|
|||
|
||||
describe Oga::XML::Parser do
|
||||
context 'XML declaration tags' do
|
||||
example 'lex an XML declaration tag' do
|
||||
example 'parse an empty XML declaration tag' do
|
||||
parse('<?xml?>').should == s(:document, s(:xml_decl))
|
||||
end
|
||||
|
||||
example 'parse an XML declaration tag' do
|
||||
parse('<?xml version="1.0" ?>').should == s(
|
||||
:document,
|
||||
s(:xml_decl, s(:attributes, s(:attribute, 'version', '1.0')))
|
||||
|
|
Loading…
Reference in New Issue