Skip to content
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

Separate core language tests for re-use in other liquid implementations #1621

Open
dylanahsmith opened this issue Sep 13, 2022 · 0 comments
Open

Comments

@dylanahsmith
Copy link
Contributor

Ideally, we would have tests for the liquid language that could be shared for re-use across liquid implementations. This would better support re-implementations of liquid for performance reasons (e.g. liquid-c) or for making it usable from a different language.

These tests could be written in YAML without language specific extensions. The tests could then be run in ruby using meta-programming to define unit test methods for each YAML test. A ruby gem (from within this repo) could be provided for reimplementations of liquid with ruby bindings, which would just require an adapter for the implementations liquid API. Porting liquid for use from another language could just re-use the YAML and require some additional code to run/generate tests for each YAML test. Either way, this would allow for greater compatibility between implementations and simplify experimentation.


As a transitionary step, tests that can be decoupled from this library's API should use test helpers like assert_template_result & assert_match_syntax_error that abstract from the library API, as #1611 started to do.

Tests for liquid extensions (e.g. custom drops, tags or filters) would depend on the library API and should probably be distinguished from language tests so they don't get converted to YAML tests. Perhaps they shouldn't use those decoupled test helpers like assert_template_result or assert_match_syntax_error to make it easier to separate those tests when we are ready to rewrite them in YAML.

Each YAML test would provide the liquid source, expected output and parameters for a single render. As such, we would need to separate ruby test methods that perform multiple renders into their own named test.

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

No branches or pull requests

1 participant