Skip to content

Commit

Permalink
add test skipping deleted keys in Object.{assign, entries, values}
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 26, 2015
1 parent 1d3a4ce commit 6dad33d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/library/es6.object.assign.ls
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ test 'Object.assign' (assert)->
assert.strictEqual O.b, void, \b
assert.strictEqual O[c], \c, \c
assert.strictEqual O[d], void, \d
try assert.strictEqual Function('return core.Object.assign({b: 1}, {get a(){delete this.b;},b: 2})')!b, 1
# test deterministic property order, theoretical can fail with deterministic, but wrong, order
string = 'abcdefghijklmnopqrst';
O = {}
Expand Down
3 changes: 2 additions & 1 deletion tests/library/es7.object.entries.ls
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ test 'Object.entries' (assert)->
if \name of entries => assert.strictEqual entries.name, \entries, 'name is "entries"'
assert.deepEqual entries({q:1, w:2, e:3}), [[\q 1] [\w 2] [\e 3]]
assert.deepEqual entries(new String \qwe), [[\0 \q] [\1 \w] [\2 \e]]
assert.deepEqual entries(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [[\a 4] [\s 5] [\d 6]]
assert.deepEqual entries(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [[\a 4] [\s 5] [\d 6]]
try assert.deepEqual Function('return core.Object.entries({a: 1, get b(){delete this.c;return 2},c: 3})')!, [[\a 1], [\b 2]]
3 changes: 2 additions & 1 deletion tests/library/es7.object.values.ls
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ test 'Object.values' (assert)->
if \name of values => assert.strictEqual values.name, \values, 'name is "values"'
assert.deepEqual values({q:1, w:2, e:3}), [1 2 3]
assert.deepEqual values(new String \qwe), [\q \w \e]
assert.deepEqual values(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [4 5 6]
assert.deepEqual values(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [4 5 6]
try assert.deepEqual Function('return core.Object.values({a: 1, get b(){delete this.c;return 2},c: 3})')!, [1 2]
1 change: 1 addition & 0 deletions tests/tests/es6.object.assign.ls
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test 'Object.assign' (assert)->
assert.strictEqual O.b, void, \b
assert.strictEqual O[c], \c, \c
assert.strictEqual O[d], void, \d
try assert.strictEqual Function('return Object.assign({b: 1}, {get a(){delete this.b;},b: 2})')!b, 1
# test deterministic property order, theoretical can fail with deterministic, but wrong, order
string = 'abcdefghijklmnopqrst';
O = {}
Expand Down
3 changes: 2 additions & 1 deletion tests/tests/es7.object.entries.ls
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ test 'Object.entries' (assert)->
assert.strictEqual entries.name, \entries, 'name is "entries"'
assert.deepEqual entries({q:1, w:2, e:3}), [[\q 1] [\w 2] [\e 3]]
assert.deepEqual entries(new String \qwe), [[\0 \q] [\1 \w] [\2 \e]]
assert.deepEqual entries(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [[\a 4] [\s 5] [\d 6]]
assert.deepEqual entries(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [[\a 4] [\s 5] [\d 6]]
try assert.deepEqual Function('return Object.entries({a: 1, get b(){delete this.c;return 2},c: 3})')!, [[\a 1], [\b 2]]
3 changes: 2 additions & 1 deletion tests/tests/es7.object.values.ls
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ test 'Object.values' (assert)->
assert.strictEqual values.name, \values, 'name is "values"'
assert.deepEqual values({q:1, w:2, e:3}), [1 2 3]
assert.deepEqual values(new String \qwe), [\q \w \e]
assert.deepEqual values(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [4 5 6]
assert.deepEqual values(assign create({q:1, w:2, e:3}), {a:4, s:5, d:6}), [4 5 6]
try assert.deepEqual Function('return Object.values({a: 1, get b(){delete this.c;return 2},c: 3})')!, [1 2]

0 comments on commit 6dad33d

Please sign in to comment.