New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected code block content ignores language type #1

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@nanis

nanis commented Feb 17, 2016

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

This comment has been minimized.

Owner

nwellnhof commented Feb 17, 2016

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

This comment has been minimized.

Owner

nwellnhof commented Feb 17, 2016

Fixed in master: 1ef3c45

@nwellnhof nwellnhof closed this Feb 17, 2016

@nanis nanis deleted the nanis:nanis-test-fix branch Feb 17, 2016

@nanis

This comment has been minimized.

nanis commented Feb 17, 2016

Nicely done.

@nwellnhof

This comment has been minimized.

Owner

nwellnhof commented Feb 17, 2016

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