Skip to content

Commit

Permalink
Add tests to increase spec coverage
Browse files Browse the repository at this point in the history
parse5 is now tracking the test coverage of its codebase. The tests here all cover areas that previously didn't have tests.

Co-authored-by: Mike Dalessio <[email protected]>
  • Loading branch information
fb55 and flavorjones authored Aug 17, 2023
1 parent 8b45ec2 commit a9f4496
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tree-construction/quirks01.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#data
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><p><table>
#errors
(2,54): unknown-doctype
(2,64): eof-in-table
#document
| <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
| <html>
| <head>
| <body>
| <p>
| <table>

#data
<!DOCTYPE html SYSTEM "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"><p><table>
#errors
(1,83): unknown-doctype
(1,93): eof-in-table
#document
| <!DOCTYPE html "" "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd">
| <html>
| <head>
| <body>
| <p>
| <table>

#data
<!DOCTYPE html PUBLIC "html"><p><table>
#errors
(1,30): unknown-doctype
(1,39): eof-in-table
#document
| <!DOCTYPE html "html" "">
| <html>
| <head>
| <body>
| <p>
| <table>

#data
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"
"http://www.w3.org/TR/html4/strict.dtd"><p><table>
#errors
(2,43): unknown-doctype
(2,53): eof-in-table
#document
| <!DOCTYPE html "-//W3C//DTD HTML 3.2//EN" "http://www.w3.org/TR/html4/strict.dtd">
| <html>
| <head>
| <body>
| <p>
| <table>
14 changes: 14 additions & 0 deletions tree-construction/tables01.dat
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,17 @@
| <table>
| <s>
| <table>

#data
<table>a<!doctype html>
#errors
(1,1): expected-doctype-but-got-start-tag
(1,8): illegal-character-token
(1,9): illegal-doctype
(1,24): expected-closing-tag-but-got-eof
#document
| <html>
| <head>
| <body>
| "a"
| <table>
10 changes: 10 additions & 0 deletions tree-construction/tests2.dat
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@
| <head>
| <body>

#data
<!DOCTYPE html> <!DOCTYPE html>
#errors
Line: 1 Col: 31 Unexpected DOCTYPE. Ignored.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>

#data
test
test
Expand Down
16 changes: 16 additions & 0 deletions tree-construction/tests4.dat
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,19 @@ head
#document
| <title>
| "setting head's innerHTML"

#data
direct <title> content
#errors
#document-fragment
title
#document
| "direct <title> content"

#data
<!-- inside </script> -->
#errors
#document-fragment
script
#document
| "<!-- inside </script> -->"
36 changes: 36 additions & 0 deletions tree-construction/tests7.dat
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,42 @@
| "X"
| <body>

#data
<!doctype html></head><base>X
#errors
(1,28): unexpected-start-tag-out-of-my-head
#document
| <!DOCTYPE html>
| <html>
| <head>
| <base>
| <body>
| "X"

#data
<!doctype html></head><basefont>X
#errors
(1,32): unexpected-start-tag-out-of-my-head
#document
| <!DOCTYPE html>
| <html>
| <head>
| <basefont>
| <body>
| "X"

#data
<!doctype html></head><bgsound>X
#errors
(1,31): unexpected-start-tag-out-of-my-head
#document
| <!DOCTYPE html>
| <html>
| <head>
| <bgsound>
| <body>
| "X"

#data
<!doctype html><table><meta></table>
#errors
Expand Down

0 comments on commit a9f4496

Please sign in to comment.