Skip to content

LiquidJS conformance gaps against Golden Liquid #1004

Open

Description

@DicksonWu654

I don't think this has security impact. This is a Golden Liquid conformance report, and I'm happy to split it or send PRs. Tested npm [email protected] and main af9b02d58612e4f739300f8067b584d291e426c1 with default options. Data is {}; outputs are Golden/LiquidJS.

Filters (6 cases; Golden sections blank_and_empty, filters/default, filters/replace, filters/round). Golden requires nil == blank, allow_false before fallback, undefined replacement as empty, and integer round precision. LiquidJS compares EmptyDrop as false, rejects argument order, uses split/join, and rounds fractions. {% if nil == blank %}TRUE{% else %}FALSE{% endif %} -> TRUE/FALSE (blank_and_empty:nil is equal to blank); {{ 5.666 | round: 1.2 }} -> 5.7/5.666 (filters/round:argument is a float).

Nested comments (2 cases). Shopify allows nesting; LiquidJS stops at the first endcomment. {% comment %}{% comment %}x{% endcomment %}{% endcomment %} -> empty/ParseError (tags/comment:nested comment blocks); {% comment %}{% comment %}{% if true %}x{% endif %}{% endcomment %}{% endcomment %} -> empty/ParseError (tags/comment:nested comment blocks, with nested tags).

Named cycles (4 cases). Golden keeps a named counter across lists; LiquidJS keys state by candidates. {% cycle 'a': 1, 2 %}{% cycle 'a': 7, 8 %} -> 18/17 (tags/cycle:named with different items); {% cycle a: '1', '2' %}{% cycle a: '1', '2', '3' %}{% cycle a: '1' %} -> 12/111 (tags/cycle:named with different number of arguments).

Loops and tablerow (9 cases). LiquidJS slices modifiers and misses break in its row loop. {% for i in (0..3) offset: -2 %}{{ i }} {% endfor %} -> 0 1 2 3/2 3 (tags/for:range loop, negative offset); {% tablerow n in (1..3) cols:2 %}{{n}}{% break %}{{n}}{% endtablerow %} -> one row/two rows (tags/tablerow:break from a tablerow loop).

Remaining jg-rp/golden-liquid cases:

  • blank_and_empty:null is equal to blank
  • filters/default:false keyword argument before positional
  • filters/default:true keyword argument before positional
  • filters/replace:undefined first argument
  • tags/cycle:named with growing number of arguments
  • tags/cycle:named with shrinking number of arguments
  • tags/for:range loop, negative offset, continue
  • tags/for:range loop, negative offset, limit
  • tags/for:range loop, negative offset, negative limit
  • tags/for:range loop, offset, negative limit
  • tags/tablerow:negative offset
  • tags/tablerow:negative offset and limit
  • tags/tablerow:break from a tablerow loop inside a for loop

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions