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

fixes setting array syntax #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fixes setting array syntax #7

wants to merge 1 commit into from

Conversation

zzantozz
Copy link

Existing handling of setting array indexes has a couple of issues. First, it calls a non-existent lists:append/3 in a couple of places. It also mishandles setting the first element of an array greater than length one. This adds tests that cover the problem spots in the code and fixes the problems.

Problem behavior before this change can be seen in

> props:set("a[1].b", 2, {[{<<"a">>, [{[{<<"b">>, 1}]}]}]}).
** exception error: undefined function lists:append/3
     in function  props:do_set/3 (/vagrant/lib/props/src/props.erl, line 176)

and

> props:set("a[1]", 2, {[{<<"a">>, [4,5,6]}]}).
{[{<<"a">>,[2,6]}]}

Existing handling of setting array indexes has a couple of issues. First, it calls a non-existent lists:append/3 in a couple
of places. It also mishandles setting the first element of an array greater than length one. This adds tests that cover the
problem spots in the code and fixes the problems.
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