Skip to content

Conversation

@tobi
Copy link
Member

@tobi tobi commented Jan 2, 2026

Summary

  • Simplify the render API from (template, ctx) to (template, assigns, options)
  • Add comprehensive "basics" test suite with 183 specs covering all fundamental Liquid features
  • Add complexity-based spec ordering for progressive implementation

Changes

API Simplification

  • Render API: Changed from LiquidSpec.render { |template, ctx| } to LiquidSpec.render { |template, assigns, options| }
  • Removed the Context wrapper class - data is now passed directly
  • Adapters are simpler and more explicit about what they receive

Basics Test Suite

  • 183 specs covering all features from https://shopify.github.io/liquid/
  • Each spec includes extensive implementation hints
  • Ordered by complexity (10=simplest to 180=advanced)
  • Runs first before other suites, no required features

Complexity Feature

  • New complexity field on specs (optional)
  • Specs sorted by complexity within each suite
  • Scale: 10-20 (raw text), 30-40 (variables), 50-60 (assign/if), 70-80 (loops), 90-100 (capture/case), 110-130 (special tags), 150-180 (edge cases)

Other

  • Fixed ASCII diagram alignment in README
  • Added documentation comments to Configuration class

tobi added 5 commits January 1, 2026 21:01
- Remove Context wrapper class from adapter_dsl
- Pass assigns and options directly to render block
- Move deep_copy and register building to runner
- Update example adapters to use new API
- Update README documentation
The basics suite covers fundamental Liquid features from the official
documentation at https://shopify.github.io/liquid/. Every implementation
should pass these tests.

Features covered:
- Raw text output
- Object output ({{ }})
- Whitespace control ({{- -}})
- Variable assignment (assign, capture)
- Filters (50+ filters with examples)
- Conditionals (if/elsif/else/unless)
- Case/when statements
- For loops with forloop object
- Increment/decrement
- Comments (block and inline)
- Raw tag
- Echo and liquid tags
- Property access (dot and bracket notation)
- Truthy/falsy evaluation
- Cycle and tablerow

Each spec includes extensive hints explaining how the feature should
be implemented, making this suite ideal for new Liquid implementations.

The basics suite runs first (before other suites) and has no required
features, ensuring all implementations can run it.
- Add 'complexity' field to Unit struct and YAML source loading
- Sort specs by complexity within each suite (lower = simpler)
- Specs without complexity run last (infinity sort value)
- Add complexity values to all 183 basics specs

Complexity scale:
  10-20: Raw text, literals (no parsing logic)
  30-40: Variables, basic filters
  50-60: Assign, simple conditionals
  70-80: For loops, filter chains
  90-100: Complex control flow, capture
  110-130: Special tags (increment, comments, liquid)
  150-170: Property access, truthy/falsy edge cases
  180-200: Advanced features, edge cases

This ensures new Liquid implementations can work through specs in
order of increasing difficulty.
@tobi tobi merged commit b7c783a into main Jan 2, 2026
1 of 2 checks passed
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.

1 participant