Skip to content

Commit

Permalink
Add test for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jul 23, 2024
1 parent 635af12 commit 96c1d9c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/parse/test_entity_declaration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@ def test_entity_value_and_notation_data_declaration
DETAIL
end
end

def test_no_space
exception = assert_raise(REXML::ParseException) do
REXML::Document.new('<!DOCTYPE root [<!ENTITY valid-namePUBLIC"valid-pubid-literal""valid-system-literal"NDATAvalid-name>]>')
end
assert_equal(<<-DETAIL.chomp, exception.to_s)
Malformed entity declaration
Line: 1
Position: 102
Last 80 unconsumed characters:
valid-namePUBLIC\"valid-pubid-literal\"\"valid-system-literal\"NDATAvalid-name>]>
DETAIL
end
end

# https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl
Expand Down Expand Up @@ -397,6 +410,19 @@ def test_entity_value_and_notation_data_declaration
DETAIL
end
end

def test_no_space
exception = assert_raise(REXML::ParseException) do
REXML::Document.new('<!DOCTYPE root [<!ENTITY %valid-nameSYSTEM"valid-system-literal">]>')
end
assert_equal(<<-DETAIL.chomp, exception.to_s)
Malformed entity declaration
Line: 1
Position: 67
Last 80 unconsumed characters:
%valid-nameSYSTEM\"valid-system-literal\">]>
DETAIL
end
end

def test_empty
Expand Down

0 comments on commit 96c1d9c

Please sign in to comment.