mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
36 tests covering the three optimization sites:
Expression.parse_number (13 tests):
- Simple integers, negatives, floats, trailing dots
- Multi-dot truncation (1.2.3 → 1.2)
- Rejection of non-numeric input and trailing alpha (1.2.3a)
Expression.parse strip guard (7 tests):
- Leading, trailing, both-sides whitespace
- No-strip-needed case (no allocation)
- Null byte stripping (matches String#strip behavior)
VariableLookup.simple_lookup? (8 tests):
- Accepts: single names, dotted chains, question marks, hyphens
- Rejects: brackets, empty, leading/trailing dots, double dots
VariableLookup fast path equivalence (7 tests):
- name/lookups/command_flags match for simple and deep chains
- Bracket inputs fall through to regex path correctly
BlockBody.try_parse_tag_token (10 tests):
- Simple tags, whitespace control variants ({%-, -%}, both)
- No-markup tags, hash comments, newline counting
- Hyphenated names stop at hyphen (matching TagName = /\w+/)
- Malformed tokens return nil (fallback to FullToken regex)