Skip to content

Integers as keys#9

Open
cjkjellander wants to merge 5 commits intocvik:masterfrom
campanja-forks:integers-as-keys
Open

Integers as keys#9
cjkjellander wants to merge 5 commits intocvik:masterfrom
campanja-forks:integers-as-keys

Conversation

@cjkjellander
Copy link

We discovered that by accident lejson worked on using integers as keys, but only if the integer what 0-255. This fixes so all integers can be used as keys and with a new option they can be decoded to the same map as before encoding.

New option integer_and_atom

  1) lejson_test:config_test_/0: integer_as_key
     Failure/Error: {error,badarg,
                        [{erlang,iolist_to_binary,
                             [["{",["\"",256,"\"",":",[<<"1">>]],"}"]],
                             []},
                         {lejson,encode,1,
                             [{file,
                                  "/home/cjk/git/campanja/lejson/src/lejson.erl"},
                              {line,32}]},
                         {lejson_test,test_opts,1,
                             [{file,
                                  "/home/cjk/git/campanja/lejson/test/lejson_test.erl"},
                              {line,123}]},
                         {eunit_test,run_testfun,1,
                             [{file,"eunit_test.erl"},{line,71}]},
                         {eunit_proc,run_test,1,
                             [{file,"eunit_proc.erl"},{line,510}]},
                         {eunit_proc,with_timeout,3,
                             [{file,"eunit_proc.erl"},{line,335}]},
                         {eunit_proc,handle_test,2,
                             [{file,"eunit_proc.erl"},{line,493}]},
                         {eunit_proc,tests_inorder,3,
                             [{file,"eunit_proc.erl"},{line,435}]}]}

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