Skip to content

Commit

Permalink
add tests for float-type string keys
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Sep 8, 2018
1 parent 6168ee5 commit 0cbf2c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ test('dset', t => {
fn(foo, ['x', 'y', 'z'], 123);
t.same(foo, { x:{ y:{ z:123 } } });

foo = {};
fn(foo, ['x', '0', 'z'], 123);
t.same(foo, { x:[{ z:123 }] });
t.true(Array.isArray(foo.x));

foo = {};
fn(foo, ['x', '1', 'z'], 123);
t.same(foo, { x:[,{ z:123 }] });
t.true(Array.isArray(foo.x));

foo = {};
fn(foo, ['x', '10.0', 'z'], 123);
t.same(foo, { x:{ '10.0':{ z:123 } } });
t.false(Array.isArray(foo.x));

foo = {};
fn(foo, ['x', '10.2', 'z'], 123);
t.same(foo, { x:{ '10.2':{ z:123 } } });
Expand Down

0 comments on commit 0cbf2c6

Please sign in to comment.