Skip to content

Conversation

@rbewley4
Copy link

I copied the source code from php-markdown (just the Michelf directory) and put it in mdtest/Implementations. The existing files were modified to be wrappers so that the test harness would work with (minimal) modifications.

The tests don't do very well unless you check the "Normalize" option. Is that normal?

It may be a good idea to convert the php-markdown source into a submodule in the future, so that it's easier to pull the latest changes.

@michelf
Copy link
Owner

michelf commented Apr 11, 2013

It's normal, you do need normalize. I should have told you, sorry. If you don't, any difference in normally insignificant whitespace will cause a failure.

As for submodules, it never occurred to me they could be used here, but it might be a good idea. My plan instead was to get rid of the Implementations folder and tell people to do what I do myself. What I do to test the lib branch currently is I open a terminal window in the folder having mdtest and run this:

./mdtest.php -l "path/to/markdown-test-wrapper.php" -f Markdown -t "Markdown" -t "PHP Markdown" -n
./mdtest.php -l "path/to/markdown-test-wrapper.php" -f MarkdownExtra -t "Markdown" -t "PHP Markdown" -t "PHP Markdown Extra" -n

The wrapper I use looks like this:

<?php

# Install PSR-0-compatible class autoloader
spl_autoload_register(function($class){
    require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
});

function Markdown($text)
{
    return Michelf\Markdown::defaultTransform($text);
}

function MarkdownExtra($text)
{
    return Michelf\MarkdownExtra::defaultTransform($text);
}

To test the master and extra branches I do the same thing directly with the path to markdown.php (with no intermediary wrapper file, not needed) and no -f (the function name is always the default Markdown).

I don't think the intermediary wrappers belong in MDTest, nor in PHP Markdown. Instead, mdtest should be changed so it can deal directly with the new format. I'm not sure how to do that in a generic way yet, as I want mdtest to stay compatible with the old packaging too.

@michelf
Copy link
Owner

michelf commented Nov 28, 2013

I just made a big update to MDTest. It now links to PHP Markdown as a submodule and has good support for autoloading. See the newly added Readme file.

@michelf michelf closed this Nov 28, 2013
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