Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. {"tests": [
  2.  
  3. {"description":"Correct Doctype lowercase",
  4. "input":"<!DOCTYPE html>",
  5. "output":[["DOCTYPE", "html", null, null, true]]},
  6.  
  7. {"description":"Correct Doctype uppercase",
  8. "input":"<!DOCTYPE HTML>",
  9. "output":[["DOCTYPE", "html", null, null, true]]},
  10.  
  11. {"description":"Correct Doctype mixed case",
  12. "input":"<!DOCTYPE HtMl>",
  13. "output":[["DOCTYPE", "html", null, null, true]]},
  14.  
  15. {"description":"Correct Doctype case with EOF",
  16. "input":"<!DOCTYPE HtMl",
  17. "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
  18.  
  19. {"description":"Truncated doctype start",
  20. "input":"<!DOC>",
  21. "output":["ParseError", ["Comment", "DOC"]]},
  22.  
  23. {"description":"Doctype in error",
  24. "input":"<!DOCTYPE foo>",
  25. "output":[["DOCTYPE", "foo", null, null, true]]},
  26.  
  27. {"description":"Single Start Tag",
  28. "input":"<h>",
  29. "output":[["StartTag", "h", {}]]},
  30.  
  31. {"description":"Empty end tag",
  32. "input":"</>",
  33. "output":["ParseError"]},
  34.  
  35. {"description":"Empty start tag",
  36. "input":"<>",
  37. "output":["ParseError", ["Character", "<>"]]},
  38.  
  39. {"description":"Start Tag w/attribute",
  40. "input":"<h a='b'>",
  41. "output":[["StartTag", "h", {"a":"b"}]]},
  42.  
  43. {"description":"Start Tag w/attribute no quotes",
  44. "input":"<h a=b>",
  45. "output":[["StartTag", "h", {"a":"b"}]]},
  46.  
  47. {"description":"Start/End Tag",
  48. "input":"<h></h>",
  49. "output":[["StartTag", "h", {}], ["EndTag", "h"]]},
  50.  
  51. {"description":"Two unclosed start tags",
  52. "input":"<p>One<p>Two",
  53. "output":[["StartTag", "p", {}], ["Character", "One"], ["StartTag", "p", {}], ["Character", "Two"]]},
  54.  
  55. {"description":"End Tag w/attribute",
  56. "input":"<h></h a='b'>",
  57. "output":[["StartTag", "h", {}], "ParseError", ["EndTag", "h"]]},
  58.  
  59. {"description":"Multiple atts",
  60. "input":"<h a='b' c='d'>",
  61. "output":[["StartTag", "h", {"a":"b", "c":"d"}]]},
  62.  
  63. {"description":"Multiple atts no space",
  64. "input":"<h a='b'c='d'>",
  65. "output":["ParseError", ["StartTag", "h", {"a":"b", "c":"d"}]]},
  66.  
  67. {"description":"Repeated attr",
  68.  "input":"<h a='b' a='d'>",
  69.  "output":["ParseError", ["StartTag", "h", {"a":"b"}]]},
  70.  
  71. {"description":"Simple comment",
  72.  "input":"<!--comment-->",
  73.  "output":[["Comment", "comment"]]},
  74.  
  75. {"description":"Comment, Central dash no space",
  76.  "input":"<!----->",
  77.  "output":["ParseError", ["Comment", "-"]]},
  78.  
  79. {"description":"Comment, two central dashes",
  80. "input":"<!-- --comment -->",
  81. "output":["ParseError", ["Comment", " --comment "]]},
  82.  
  83. {"description":"Unfinished comment",
  84. "input":"<!--comment",
  85. "output":["ParseError", ["Comment", "comment"]]},
  86.  
  87. {"description":"Start of a comment",
  88. "input":"<!-",
  89. "output":["ParseError", ["Comment", "-"]]},
  90.  
  91. {"description":"Short comment",
  92.  "input":"<!-->",
  93.  "output":["ParseError", ["Comment", ""]]},
  94.  
  95. {"description":"Short comment two",
  96.  "input":"<!--->",
  97.  "output":["ParseError", ["Comment", ""]]},
  98.  
  99. {"description":"Short comment three",
  100.  "input":"<!---->",
  101.  "output":[["Comment", ""]]},
  102.  
  103.  
  104. {"description":"Ampersand EOF",
  105. "input":"&",
  106. "output":[["Character", "&"]]},
  107.  
  108. {"description":"Ampersand ampersand EOF",
  109. "input":"&&",
  110. "output":[["Character", "&&"]]},
  111.  
  112. {"description":"Ampersand space EOF",
  113. "input":"& ",
  114. "output":[["Character", "& "]]},
  115.  
  116. {"description":"Unfinished entity",
  117. "input":"&f",
  118. "output":["ParseError", ["Character", "&f"]]},
  119.  
  120. {"description":"Ampersand, number sign",
  121. "input":"&#",
  122. "output":["ParseError", ["Character", "&#"]]},
  123.  
  124. {"description":"Unfinished numeric entity",
  125. "input":"&#x",
  126. "output":["ParseError", ["Character", "&#x"]]},
  127.  
  128. {"description":"Entity with trailing semicolon (1)",
  129. "input":"I'm &not;it",
  130. "output":[["Character","I'm \u00ACit"]]},
  131.  
  132. {"description":"Entity with trailing semicolon (2)",
  133. "input":"I'm &notin;",
  134. "output":[["Character","I'm \u2209"]]},
  135.  
  136. {"description":"Entity without trailing semicolon (1)",
  137. "input":"I'm &notit",
  138. "output":[["Character","I'm "], "ParseError", ["Character", "\u00ACit"]]},
  139.  
  140. {"description":"Entity without trailing semicolon (2)",
  141. "input":"I'm &notin",
  142. "output":[["Character","I'm "], "ParseError", ["Character", "\u00ACin"]]},
  143.  
  144. {"description":"Partial entity match at end of file",
  145. "input":"I'm &no",
  146. "output":[["Character","I'm "], "ParseError", ["Character", "&no"]]},
  147.  
  148. {"description":"Non-ASCII character reference name",
  149. "input":"&\u00AC;",
  150. "output":["ParseError", ["Character", "&\u00AC;"]]},
  151.  
  152. {"description":"ASCII decimal entity",
  153. "input":"&#0036;",
  154. "output":[["Character","$"]]},
  155.  
  156. {"description":"ASCII hexadecimal entity",
  157. "input":"&#x3f;",
  158. "output":[["Character","?"]]},
  159.  
  160. {"description":"Hexadecimal entity in attribute",
  161. "input":"<h a='&#x3f;'></h>",
  162. "output":[["StartTag", "h", {"a":"?"}], ["EndTag", "h"]]},
  163.  
  164. {"description":"Entity in attribute without semicolon ending in x",
  165. "input":"<h a='&notx'>",
  166. "output":["ParseError", ["StartTag", "h", {"a":"&notx"}]]},
  167.  
  168. {"description":"Entity in attribute without semicolon ending in 1",
  169. "input":"<h a='&not1'>",
  170. "output":["ParseError", ["StartTag", "h", {"a":"&not1"}]]},
  171.  
  172. {"description":"Entity in attribute without semicolon ending in i",
  173. "input":"<h a='&noti'>",
  174. "output":["ParseError", ["StartTag", "h", {"a":"&noti"}]]},
  175.  
  176. {"description":"Entity in attribute without semicolon",
  177. "input":"<h a='&COPY'>",
  178. "output":["ParseError", ["StartTag", "h", {"a":"\u00A9"}]]},
  179.  
  180. {"description":"Unquoted attribute ending in ampersand",
  181.  "input":"<s o=& t",
  182.  "output":["ParseError",["StartTag","s",{"o":"&","t":""}]]}
  183.  
  184. ]}
  185.