Shopify/liquid — pull request #435 by trishume (2014-08-28 19:07:48+00:00)
Title: Add Parser Comparison Test

This adds a somewhat useful test that checks if the strict parser and the lax parser produce the same tag tree output. On its own this is somewhat useful to make sure the strict and lax parsers do the same thing, but the real fanciness comes from the implications of the fact that this can be done.

I did this as a proof of concept for how one could test that Shopify/liquid-c does the same thing as the existing lax parser. If one was to take this code and run it on a huge dataset of Shopify shop templates then one could be reasonably confident that the two parsers behave the same.

Previous attempts to compare parsers have tried to render templates with both parsers but this is difficult to do since rendering only really works in a production environment. However, this method only needs the template data, and the parsing code for any custom tags.

This method could solve the transition problem of how to be confident that a new parser works.

@fw42 @camilo @tonyzou