Skip to content

Commit 86811a9

Browse files
committed
Add some tests that were suggested by @arv
1 parent 87098c5 commit 86811a9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/tests.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ assertThrows(function() { String.prototype.codePointAt.call(null, 4); }, TypeErr
7171
assertEquals(String.prototype.codePointAt.call(42, 0), 0x34);
7272
assertEquals(String.prototype.codePointAt.call(42, 1), 0x32);
7373
assertEquals(String.prototype.codePointAt.call({ 'toString': function() { return 'abc'; } }, 2), 0x63);
74+
var tmp = 0;
75+
assertEquals(String.prototype.codePointAt.call({ 'toString': function() { ++tmp; return String(tmp); } }, 0), 0x31);
76+
assertEquals(tmp, 1);
7477

7578
assertThrows(function() { String.prototype.codePointAt.apply(undefined); }, TypeError);
7679
assertThrows(function() { String.prototype.codePointAt.apply(undefined, [4]); }, TypeError);
@@ -79,3 +82,6 @@ assertThrows(function() { String.prototype.codePointAt.apply(null, [4]); }, Type
7982
assertEquals(String.prototype.codePointAt.apply(42, [0]), 0x34);
8083
assertEquals(String.prototype.codePointAt.apply(42, [1]), 0x32);
8184
assertEquals(String.prototype.codePointAt.apply({ 'toString': function() { return 'abc'; } }, [2]), 0x63);
85+
tmp = 0;
86+
assertEquals(String.prototype.codePointAt.apply({ 'toString': function() { ++tmp; return String(tmp); } }, [0]), 0x31);
87+
assertEquals(tmp, 1);

0 commit comments

Comments
 (0)