Skip to content

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

Open
@Slashek

Description

@Slashek

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 ?

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