Foremark icon indicating copy to clipboard operation
Foremark copied to clipboard

Modify test suite for Foremark

Open yvt opened this issue 7 years ago • 0 comments

The majority of the adopted test cases are failing.

$ node_modules/.bin/mocha
  fixture-markdown
    Markdown-from-MDTest1.1.mdtest
      1) Amps_and_angle_encoding
      2) Auto_links
      3) Backslash_escapes
      ✓ Blockquotes_with_code_blocks
      ✓ Code_Blocks
      4) Code_Spans
      5) Hard-wrapped_paragraphs_with_list-like_lines
      ✓ Horizontal_rules
Attribute name is missing.
Attribute name is missing.
Attribute name is missing.
Attribute name is missing.
Attribute name is missing.
      6) Images
      7) Inline_HTML_(Advanced)
      8) Inline_HTML_(Simple)
      9) Inline_HTML_comments
      10) Links_inline_style
      11) Links_reference_style
      12) Links_shortcut_references
A separator between attributes is missing.
Invalid attribute name: 'quotes"'
Invalid attribute name: 'inside"'
A separator between attributes is missing.
Invalid attribute name: 'quotes"'
Invalid attribute name: 'inside"'
      13) Literal_quotes_in_titles
      ✓ Markdown_Documentation_-_Basics (85ms)
      14) Markdown_Documentation_-_Syntax
      ✓ Nested_blockquotes
      15) Ordered_and_unordered_lists
      16) Strong_and_em_together
      17) Tabs
      18) Tidyness
    PHP_Markdown-from-MDTest1.1.mdtest
      19) Backslash_escapes
      ✓ Code_Spans
      20) Code_block_in_a_list_item
      21) Email_auto_links
      22) Emphasis
      23) Headers
      ✓ Horizontal_Rules
      24) Inline_HTML_(Simple)
      25) Inline_HTML_(Span)
      26) Inline_HTML_comments
      27) Ins_and_del
      28) Links_inline_style
      ✓ MD5_Hashes
      29) Nesting
      30) PHP-Specific_Bugs
      31) Parens_in_URL
      32) Tight_blocks
    Text-Markdown.mdtest
      33) CoreDumps5.8
      34) Emphasis
      35) HTML-Comment-encoding
      ✓ HTML5-attributes
      36) Links_brackets
      37) Links_multiline_bugs_1
      38) Links_multiline_bugs_2
      39) Links_reference_style
      40) Lists-multilevel-md5-edgecase
      41) PHP-ASP_tags
      ✓ Unicode
    docs-maruku-unittest
      42) abbreviations
      ✓ alt
      ✓ blank
      43) blanks_in_code
      44) bug_def
      45) bug_table
      46) code
      47) code2
      48) code3
      49) data_loss
      ✓ easy
      50) email
      51) entities
      52) escaping
      53) extra_dl
      54) extra_header_id
      55) extra_table1
      56) footnotes
      57) headers
      58) hex_entities
      59) hrule
      60) html2
      61) html3
      62) html4
      63) html5
      64) ie
Attribute name is missing.
Attribute name is missing.
Attribute name is missing.
A separator between attributes is missing.
Attribute name is missing.
Attribute name is missing.
      65) images
      66) images2
      67) inline_html
      68) inline_html2
      69) links
      70) list1
      71) list2
      72) list3
      73) list4
      74) lists
      75) lists11
      ✓ lists6
      76) lists7
      77) lists7b
      78) lists8
      79) lists9
      80) lists_after_paragraph
      81) lists_ol
      82) loss
      83) misc_sw
      84) olist
      ✓ one
      ✓ paragraph
      85) paragraphs
      86) smartypants
      87) syntax_hl
      88) table_attributes
      89) test
      90) wrapping
      91) xml
      92) xml2
      93) xml3
      94) xml_instruction
    docs-php-markdown
      95) Backslash_escapes
      ✓ Code_Spans
      96) Code_block_in_a_list_item
      97) Headers
      98) Images_(Untitled)
      99) Inline_HTML_(Simple)
      100) Inline_HTML_comments
      101) PHP-Specific_Bugs
      102) Tight_blocks
    docs-php-markdown-extra
      103) Abbr
      104) Definition_Lists
      105) Emphasis
      106) Footnotes
      107) Inline_HTML_with_Markdown_content
      108) Tables
    docs-php-markdown-todo
      109) Email_auto_links
      110) Emphasis
      111) Inline_HTML_(Span)
      112) Ins_and_del
      113) Links_inline_style
      114) Nesting
      115) Parens_in_URL
    docs-pythonmarkdown2-tm-cases-pass
      116) auto_link
      ✓ blockquote
      117) blockquote_with_pre
      118) code_block_with_tabs
      119) codeblock
      120) codespans
      121) emacs_head_vars
      122) emacs_tail_vars
      123) emphasis
      124) escapes
      125) footnotes
      126) footnotes_letters
      127) footnotes_markup
      128) footnotes_safe_mode_escape
      129) header
      130) hr
      131) img_in_link
Attribute name is missing.
      132) inline_links
Invalid attribute name: '(link'
Invalid attribute name: 'syntax)'
      133) link_defn_alt_title_delims
      134) link_patterns
      135) link_patterns_double_hit
      136) link_patterns_edge_cases
      137) lists
      138) mismatched_footnotes
      ✓ missing_link_defn
      139) nested_list
      140) nested_list_safe_mode
      141) parens_in_url_4
      142) raw_html
      143) ref_links
      144) sublist-para
      145) syntax_color
      146) tricky_anchors
      147) underline_in_autolink

  reference.mf.xhtml
    1.1 Header
      ✓ " **Document title** ..."
    1.2 Block quotations
      ✓ "Here comes a famous ..."
      ✓ "> <i>This `<i>` elem..."
    1.3 Fenced code blocks
      ✓ " ~~~~~~~~~~~~~~~~~~~..."
      ✓ " ```````````````````..."
    1.4 HTML tags
      ✓ "Valid tag: <br /> Ex..."
    1.5.1 Normal hyperlinks
      ✓ "[This](https://www.e..."
    1.5.2 Symbolic hyperlinks
      ✓ "[**This**] [] is a s..."
      ✓ "[This][example] is n..."
    1.6 Media
      ✓ "The pudding face loo..."
      ✓ "The pudding faces ar..."
      ✓ "![](https://derpicdn..."
    1.9 Headings
      ✓ "First level ========..."
    1.10 Horizontal rules
      ✓ "----- - - - _____ _ ..."
    1.11 Lists
      148) "- Marker line Non-ma..."
      ✓ "- Marker line - Mark..."
      ✓ "- Item1 - Item2 1. I..."
      ✓ "1. Item1 3. Item2 4...."
      ✓ "Asymmetric cryptogra..."
    1.12 Admonitions
      ✓ "!!! Danger: Can I ha..."
    1.13 Equations
      ✓ "$$ \Lo(X, \wo) = \Le..."
    1.15 Paragraphs
      ✓ "Lorem ipsum dolor si..."
    1.16 Text styles
      ✓ "Lorem ipsum dolor **..."

  utils/dom
    legalizeAttributes
      ✓ should handle input with a new line character
      ✓ should handle empty input

  utils/array
    arrayRemoveElement
      ✓ should remove a matching element 1
      ✓ should remove a matching element 2
      ✓ should remove a matching element 3
      ✓ should remove only the first matching element
      ✓ does nothing if no element matches

  utils/lazy/Lazy
    ✓ should evaluate lazily

  utils/string
    removePrefix
      ✓ should remove "12" from "123"
      ✓ should return "3" when told to remove "124" from "123"
      ✓ should return "123" when told to remove "32" from "123"
    analyzeIndent
      ✓ returns "Indent" when `indent` has more characters
      ✓ returns "Outdent" when `indent` has less characters
      ✓ returns "Preserve" when `indent` is equal to `ref`
      ✓ returns "Outdent" when the common longest prefix is shorter than `ref`
    escapeRegExp
      ✓ escapes special characters


  57 passing (4s)
  148 failing

Some of them are due to intentional differences between Foremark and Markdown:

      -Here's another where the [link
      -breaks] across lines, but with a line-ending space.</p>
      +Here's another where the<a href="/url/">link
      +breaks</a>across lines, but with a line-ending space.</p>
      -<p>
      -this code block is indented by one tab</p>
      -<p>
      +<mf-codeblock><mf-code type="">this code block is indented by one tab</mf-code></mf-codeblock><p>

Some of them are caused by Foremark's extensions:

      -</li><li class="minus"><p>
      +</li><li><p>

Some of them are clearly failing because of a bug in Foremark:

  19) fixture-markdown
       PHP_Markdown-from-MDTest1.1.mdtest
         Backslash_escapes:
     TypeError: Cannot read property '0' of null
      at replaceBlocks (dist/converter/blocks.js:316:52)
      at Object.transformHtmlWith (dist/utils/dom.js:108:12)
      at expandMfText (dist/converter/mftext.js:313:11)
      at runSingle (test/mftext.js:36:5)
      at Context.it (test/mftext.js:135:17)

Some of them are caused by malformed reference HTML:

  26) fixture-markdown
       PHP_Markdown-from-MDTest1.1.mdtest
         Inline_HTML_comments:
     Error: undefined:3:14: malformed comment.
      at SaxesParser.fail (node_modules/saxes/lib/saxes.js:476:18)
      at SaxesParser.sCommentEnded (node_modules/saxes/lib/saxes.js:978:12)
      at SaxesParser.write (node_modules/saxes/lib/saxes.js:527:23)
      at HTMLToDOM._parseWithSaxes (node_modules/jsdom/lib/jsdom/browser/htmltodom.js:171:12)
      at HTMLToDOM._doParse (node_modules/jsdom/lib/jsdom/browser/htmltodom.js:48:75)
      at HTMLToDOM.appendToNode (node_modules/jsdom/lib/jsdom/browser/htmltodom.js:38:17)
      at setInnerHTML (node_modules/jsdom/lib/jsdom/living/helpers/html.js:22:25)
      at HTMLUnknownElementImpl.set innerHTML [as innerHTML] (node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js:195:5)
      at HTMLUnknownElement.set innerHTML [as innerHTML] (node_modules/jsdom/lib/jsdom/living/generated/Element.js:987:29)
      at Object.transformHtmlWith (dist/utils/dom.js:114:20)
      at expandMfText (dist/converter/mftext.js:228:11)
      at runSingle (test/mftext.js:36:5)
      at Context.it (test/mftext.js:135:17)

yvt avatar Jan 05 '19 14:01 yvt