-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix CommonMark test #423
Fix CommonMark test #423
Conversation
Do you mean back slash line breaks, because these are invented by CommonMark and don't exist in the original Markdown syntax. |
Yes, exactly.
However, I have to be honest: I didn't read all failing examples, just a bunch of them. I was focusing on making the tests work 😄 |
Thanks, I've been very busy preparing the next major release of @careteditor, but as soon as I have some time, I'll look into it. |
This can be used as a template for Parsedown extensions (like Parsedown Extra) to reuse Parsedown's original tests. You can either extend tests (like ParsedownExtraTest) or reuse them unchanged (like CommonMarkTest). Parsedown extensions simply have to implement their own TestParsedown class (test/TestParsedown.php) and all original tests will run with a instance of this class, rather than a instance of the original Parsedown class. This PR is a follow-up to erusev/parsedown#423, i.e. you must merge erusev/parsedown#423 first, otherwise this doesn't work.
This allows Parsedown extensions (like Parsedown Extra) to reuse existing Parsedown tests. See erusev/parsedown-extra#96 for details.
Ok, great, thanks @erusev 😃 I've now pushed commit 33a23fb to this PR what refactors Parsedown's PHPUnit bootstrap. The goal of this change is to make PHPUnit of edit: Yet another commit, 73dbe2f. No functional changes compared to 33a23fb, it simply removes the bootstrap script and uses just plain composer. |
Thanks, hopefully, I'll have a chance to review it soon enough. |
btw: It would seem useful to add the script:
- phpunit test/CommonMarkTest.php || true This way it gets very easy to check whether a PR improves CommonMark compliance or not. Should I add this to the PR @erusev? |
Sure, it'd take me some time to review the whole thing, though. |
Sure, fixing the failing tests definitely is a quite big thing, however, IMHO it is useful to merge this before actually starting to improve CommonMark compliance. |
Failing tests don't break builds on purpose, Parsedown doesn't fully comply with the CommonMark specs at the moment. We should switch to test/CommonMarkTest.php later, see erusev#423 for details.
Failing tests don't break builds on purpose, Parsedown Extra doesn't fully comply with the CommonMark specs at the moment. We should switch to test/CommonMarkTest.php of erusev/parsedown later, see erusev/parsedown#423 for details.
Sure, hopefully, I'll have some time to look into it in more depth later this month. |
Add parameter `$id` to CommonMark tests
CommonMark spec example [erusev#170](http://spec.commonmark.org/0.26/#example-170) has a empty HTML result.
Conflicts: .travis.yml test/CommonMarkTest.php test/ParsedownTest.php test/bootstrap.php
Since there was some progress related to Parsedown's build and test process and Travis lately (#539), I've solved the merge conflicts and would like to express my hope to merge this @erusev. The changes look bigger than they are, it's basically just a bugfix, but is nevertheless a huge improvement towards Parsedown's build and test process. Parsedown's |
@PhrozenByte I think this would make more sense for Parsedown 2.0 which should be more CommonMark aware. Hopefully, I can release the first commit of 2.0 in a couple of months. For the current version, I'd like to focus the limited time I can dedicate to it on priority issues. I appreciate the work that you've put here and I hope that you won't be disappointed with my response. |
I was wondering what CommonMark examples are still violated by Parsedown, but the current test is broken (its regex matching the CommonMark examples doesn't work correctly). That is why I've developed a working one.
Parsedown currently passes 287 of 616 examples (i.e. 329 failures). Here's a complete
phpunit
run: http://pastebin.com/uLaJpBWfOne of the main reasons for that many failures is that Parsedown omits whitespaces where whitespaces shouldn't be omitted according to the CommonMark specs. However, many of these whitespaces don't matter when the page is viewed by a browser. That's the reason why I've created the
test/CommonMarkTestWeak.php
: This test cleans up the HTML markup before comparison, so examples which would normally fail due to actually invisible differences (e.g. superfluous whitespaces), don't fail. However, cleanup relies on block element detection. The detection doesn't work correctly when a element'sdisplay
CSS property is manipulated. According to that this test should be only a interim solution on Parsedown's way to full CommonMark compatibility.Parsedown currently passes 338 of 616 examples (i.e. 278 failures) when less aggressively compared. Here's a complete phpunit run: http://pastebin.com/CRNbXSdq
Please note that fulfilling all CommonMark spec examples doesn't make Parsedown fully compatible to CommonMark. There are some more things to consider. However, making the examples work is a good starting point.
Please also note that Parsedown not only fails examples which represent "cases that are quite uncommon" (according to the
README.md
) - some of the failed tests are quite important (e.g. hard line breaks, #334).