From 0cbf2c60503909d29feaa37818417f4f0139178b Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Sat, 8 Sep 2018 13:22:49 -0700 Subject: [PATCH] add tests for float-type string keys --- test/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/index.js b/test/index.js index a51a90a..0bd9a78 100644 --- a/test/index.js +++ b/test/index.js @@ -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 } } });