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

What's the rational behind joining array elements on display? #177

Open
Slashek opened this issue May 16, 2022 · 0 comments
Open

What's the rational behind joining array elements on display? #177

Slashek opened this issue May 16, 2022 · 0 comments

Comments

@Slashek
Copy link

Slashek commented May 16, 2022

https://github.com/Shopify/liquid-c/blob/master/ext/liquid_c/vm.c#L117-L130 seems to be responsible for making the test

The current test (https://github.com/Shopify/liquid-c/blob/master/test/unit/variable_test.rb#L124-L126) is implemented as follows:

 def test_write_array
    output = Liquid::Template.parse("{{ ary }}").render({ "ary" => ["foo", 123, ["nested", "ary"], nil, 0.5] })
    assert_equal("foo123nestedary0.5", output)
  end

However, I can hardly find any reason for such behavior. Instead, I would expect the following assertion to pass:

output = Liquid::Template.parse("{{ ary }}").render({ "ary" => ["foo", 123, ["nested", "ary"], nil, 0.5] })
assert_equal('["foo", 123, ["nested", "ary"], nil, 0.5]', output)

Would you consider changing this behavior, which I believe would be equivalent to just removing a couple of lines of code without having to add any new ones https://github.com/Shopify/liquid-c/blob/master/ext/liquid_c/vm.c#L117-L130 ?

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