Skip to content

Expected code block content ignores language type - #1

Closed
nanis wants to merge 1 commit into
nwellnhof:masterfrom
nanis:nanis-test-fix
Closed

nanis wants to merge 1 commit into
nwellnhof:masterfrom
nanis:nanis-test-fix

Conversation

@nanis

@nanis nanis commented Feb 17, 2016

Copy link
Copy Markdown

I tried to install CommonMark-0.230002 from CPAN using cmark 4e9abf79. nmake test failed with:

not ok 2 - create_* helpers

#   Failed test 'create_* helpers'
#   at t/08_create_helpers.t line 104.
#          got: '<h2>Header</h2>
# <blockquote>
# <p>Block quote</p>
# </blockquote>
# <ol start="2">
# <li>Item 1</li>
# <li>Item 2</li>
# </ol>
# <pre><code class="language-perl">Code block</code></pre>
# <div>html</html>
# <hr />
# <p><em>emph</em>
# <a href="/url" title="link title"><strong>link text</strong></a><br />
# <img src="/facepalm.jpg" alt="alt text" title="image title" /></p>
# '
#     expected: '<h2>Header</h2>
# <blockquote>
# <p>Block quote</p>
# </blockquote>
# <ol start="2">
# <li>Item 1</li>
# <li>Item 2</li>
# </ol>
# <pre><code>Code block</code></pre>
# <div>html</html>
# <hr />
# <p><em>emph</em>
# <a href="/url" title="link title"><strong>link text</strong></aTH><br />
# <img src="/facepalm.jpg" alt="alt text" title="image title" /></p>
# '
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests

Test Summary Report
-------------------
t/08_create_helpers.t (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1

Clearly, the expected HTML does not include the class="language-perl" attribute which is set in the test code on line 50:

    CommonMark->create_code_block(
        fence_info => 'perl',
        literal    => 'Code block',
    ),

@nwellnhof

Copy link
Copy Markdown
Owner

Your patch is correct, but it breaks with older versions of libcmark. I think it's related to this commit: commonmark/cmark@e384149

Let me think about a way to fix the test for both old and new versions.

@nwellnhof

Copy link
Copy Markdown
Owner

Fixed in master: 1ef3c45

@nwellnhof nwellnhof closed this Feb 17, 2016
@nanis
nanis deleted the nanis-test-fix branch February 17, 2016 20:49
@nanis

nanis commented Feb 17, 2016

Copy link
Copy Markdown
Author

Nicely done.

@nwellnhof

Copy link
Copy Markdown
Owner

FWIW, I just released version 0.240100 containing the fix. (Might take some time until CPAN picks it up.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants