2016-12-02 01:26:25 +00:00
|
|
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2017-02-28 20:22:24 +00:00
|
|
|
InspectorTest.log("Test that descriptions for arrays, maps, and sets include the correct length or size.")
|
2016-12-02 01:26:25 +00:00
|
|
|
|
|
|
|
Promise.all([
|
|
|
|
testExpression("new Set()"),
|
|
|
|
testExpression("new Set([1,2])"),
|
|
|
|
testExpression("new Map()"),
|
|
|
|
testExpression("new Map([[1,2],[3,4]])"),
|
|
|
|
testExpression("new Array()"),
|
|
|
|
testExpression("new Array(2)"),
|
|
|
|
testExpression("new Uint8Array()"),
|
2017-03-22 21:35:14 +00:00
|
|
|
testExpression("new Uint8Array(2)"),
|
|
|
|
// WeakMap and WeakSet should not have size in description.
|
|
|
|
testExpression("new WeakMap([[{}, 42]])"),
|
|
|
|
testExpression("new WeakSet([{}])")
|
2016-12-02 01:26:25 +00:00
|
|
|
]).then(() => InspectorTest.completeTest());
|
|
|
|
|
|
|
|
function testExpression(expression) {
|
|
|
|
return Protocol.Runtime.evaluate({ expression: expression })
|
|
|
|
.then(result => InspectorTest.logMessage(result.result.result.description))
|
|
|
|
.then(() => Protocol.Runtime.evaluate({ expression: "[" + expression + "]", generatePreview: true }))
|
|
|
|
.then(result => InspectorTest.logMessage(result.result.result.preview.properties[0].value))
|
|
|
|
}
|