8000 Add test for unnecessary ndata declaration · ruby/rexml@4782084 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4782084

Browse files
committed
Add test for unnecessary ndata declaration
1 parent 7c1c59d commit 4782084

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/parse/test_entity_declaration.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ def test_prohibited_character
7171
valid-name \"% &\">]>
7272
DETAIL
7373
end
74+
75+
def test_unnecessary_ndata_declaration
76+
exception = assert_raise(REXML::ParseException) do
77+
REXML::Document.new('<!DOCTYPE root [<!ENTITY valid-name "valid-entity-value" NDATA valid-ndata-value>]>')
78+
end
79+
assert_equal(<<-DETAIL.chomp, exception.to_s)
80+
Malformed entity declaration
81+
Line: 1
82+
Position: 83
83+
Last 80 unconsumed characters:
84+
valid-name \"valid-entity-value\" NDATA valid-ndata-value>]>
85+
DETAIL
86+
end
7487
end
7588

7689
# https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID
@@ -202,6 +215,19 @@ def test_prohibited_character
202215
% valid-name \"% &\">]>
203216
DETAIL
204217
end
218+
219+
def test_unnecessary_ndata_declaration
220+
exception = assert_raise(REXML::ParseException) do
221+
REXML::Document.new('<!DOCTYPE root [<!ENTITY % valid-name "valid-entity-value" NDATA valid-ndata-value>]>')
222+
end
223+
assert_equal(<<-DETAIL.chomp, exception.to_s)
224+
Malformed entity declaration
225+
Line: 1
226+
Position: 85
227+
Last 80 unconsumed characters:
228+
% valid-name \"valid-entity-value\" NDATA valid-ndata-value>]>
229+
DETAIL
230+
end
205231
end
206232

207233
# https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID

0 commit comments

Comments
 (0)
0