blob: 1b66721bad27f0e9a0946f5efbbf7d760fd22295 [file] [log] [blame]
Tests basic correctness of ES Map object
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Map instanceof Map is false
PASS Map.prototype instanceof Map is false
PASS new Map() instanceof Map is true
PASS new Map(null) instanceof Map is true
PASS new Map(undefined) instanceof Map is true
PASS new Map(undefined, undefined) instanceof Map is true
PASS new Map(null, undefined) instanceof Map is true
PASS Map() threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(1) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(true) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map('String') threw exception TypeError: calling Map constructor without new is invalid.
PASS Map([]) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map({}) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(undefined) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(null) threw exception TypeError: calling Map constructor without new is invalid.
PASS new Map(1) threw exception TypeError: Type error.
PASS new Map(true) threw exception TypeError: Type error.
PASS new Map([]) did not throw exception.
PASS new Map({}) threw exception TypeError: Type error.
PASS new Map(undefined, null) did not throw exception.
PASS new Map(undefined, {}) did not throw exception.
PASS Object.hasOwnProperty(map, 'size') is false
PASS Map.prototype.hasOwnProperty('size') is true
PASS Map.prototype.size threw exception TypeError: Map operation called on non-Map object.
PASS Map.prototype.set.length is 2
PASS Map.prototype.has.length is 1
PASS Map.prototype.get.length is 1
PASS Map.prototype.clear.length is 0
PASS Map.prototype.keys.length is 0
PASS Map.prototype.values.length is 0
PASS Map.prototype.entries.length is 0
PASS map.size is 0
PASS map.set(-0, 1) is map
PASS map.set(0, 2) is map
PASS map.size is 1
PASS map.set(Infinity, 3) is map
PASS map.set(-Infinity, 4) is map
PASS map.set(NaN, 5) is map
PASS map.set('0', 6) is map
PASS map.set(0.1, 7) is map
PASS map.size is 6
PASS map.get(-0) is 2
PASS map.get(0) is 2
PASS map.get(Infinity) is 3
PASS map.get(-Infinity) is 4
PASS map.get(NaN) is 5
PASS map.get('0') is 6
PASS map.get(0.1) is 7
PASS map.has(-0) is true
PASS map.has(0) is true
PASS map.has(Infinity) is true
PASS map.has(-Infinity) is true
PASS map.has(NaN) is true
PASS map.has('0') is true
PASS map.has(0.1) is true
PASS map.delete(-0) is true
PASS map.delete(0) is false
PASS map.delete(Infinity) is true
PASS map.delete(-Infinity) is true
PASS map.delete(NaN) is true
PASS map.delete('0') is true
PASS map.delete(0.1) is true
PASS map.delete(-0) is false
PASS map.delete(0) is false
PASS map.delete(Infinity) is false
PASS map.delete(-Infinity) is false
PASS map.delete(NaN) is false
PASS map.delete('0') is false
PASS map.delete(0.1) is false
PASS map.get(simpleString) is map.get(otherString)
PASS map.clear() is undefined.
PASS map.size is 0
PASS map.set(0, 0) is map
PASS map.set('0', 1) is map
PASS map.set(1, 2) is map
PASS map.set('1', 3) is map
PASS map.set(2, 4) is map
PASS map.set('2', 5) is map
PASS map.set(3, 6) is map
PASS map.set('3', 7) is map
PASS map.set(4, 8) is map
PASS map.set('4', 9) is map
PASS map.set(5, 10) is map
PASS map.set('5', 11) is map
PASS map.set(6, 12) is map
PASS map.set('6', 13) is map
PASS map.size is 14
forEach #0
PASS testThis is undefined.
0
forEach #1
PASS testThis is thisValue
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
PASS map.forEach(debug) is undefined.
0 : number => 0
0 : string => 1
1 : number => 2
1 : string => 3
2 : number => 4
2 : string => 5
3 : string => 7
4 : string => 9
5 : number => 10
5 : string => 11
6 : number => 12
6 : string => 13
4 : number => 11
PASS map.get(0) is 0
PASS map.get("0") is 1
PASS map.get(1) is 2
PASS map.get("1") is 3
PASS map.get(2) is 4
PASS map.get("2") is 5
PASS map.get("3") is "replaced"
PASS map.get("4") is 9
PASS map.get(5) is 10
PASS map.get("5") is 11
PASS map.get(6) is 12
PASS map.get("6") is 13
PASS map.get(4) is 11
map.@@iterator()
PASS key is 0
PASS value is 0
PASS key is '0'
PASS value is 1
PASS key is 1
PASS value is 2
PASS key is '1'
PASS value is 3
PASS key is 2
PASS value is 4
PASS key is '2'
PASS value is 5
PASS key is 3
PASS value is 6
PASS key is '3'
PASS value is 7
PASS key is 4
PASS value is 8
PASS key is '4'
PASS value is 9
map.entries()
PASS i is 10
PASS key is 0
PASS value is 0
PASS key is '0'
PASS value is 1
PASS key is 1
PASS value is 2
PASS key is '1'
PASS value is 3
PASS key is 2
PASS value is 4
PASS key is '2'
PASS value is 5
PASS key is 3
PASS value is 6
PASS key is '3'
PASS value is 7
PASS key is 4
PASS value is 8
PASS key is '4'
PASS value is 9
PASS i is 10
map.keys()
PASS key is 0
PASS key is '0'
PASS key is 1
PASS key is '1'
PASS key is 2
PASS key is '2'
PASS key is 3
PASS key is '3'
PASS key is 4
PASS key is '4'
PASS i is 10
map.values()
PASS value is 0
PASS value is 1
PASS value is 2
PASS value is 3
PASS value is 4
PASS value is 5
PASS value is 6
PASS value is 7
PASS value is 8
PASS value is 9
PASS i is 10
Map mutation with live iterator and GC
PASS key is 1
PASS value is 2
PASS key is 3
PASS value is 6
PASS key is 4
PASS value is 8
PASS key is 5
PASS value is 10
PASS key is 7
PASS value is 14
PASS i is 5
PASS map.size is 4
test forEach
PASS key is 1
PASS value is 2
PASS key is 3
PASS value is 6
PASS key is 4
PASS value is 8
PASS key is 5
PASS value is 10
PASS key is 7
PASS value is 14
PASS i is 5
PASS map.size is 4
A dead iterator should remain dead
PASS count is 0
PASS count is 3
PASS count is 3
PASS successfullyParsed is true
TEST COMPLETE