From 59e2a7ac57535fffcfe73f9ec919fc3f364c832b Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 16 Mar 2015 15:17:50 -0400 Subject: Import tests from Google V8 (Symbol) These tests are derived from the following files within the Google V8 project: test/mjsunit/harmony/private.js --- test/built-ins/Map/symbol-as-entry-key.js | 19 +++++++++++++++++++ test/built-ins/Map/symbol-species.js | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/built-ins/Map/symbol-as-entry-key.js create mode 100644 test/built-ins/Map/symbol-species.js (limited to 'test/built-ins/Map') diff --git a/test/built-ins/Map/symbol-as-entry-key.js b/test/built-ins/Map/symbol-as-entry-key.js new file mode 100644 index 000000000..cf82d615a --- /dev/null +++ b/test/built-ins/Map/symbol-as-entry-key.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4 +description: > + Symbol as Map key +features: [Map] +---*/ +var map = new Map(); +var sym = Symbol(); + +map.set(sym, 1); + +assert.sameValue(map.size, 1, "The value of `map.size` is `1`, after executing `map.set(sym, 1)`"); +assert.sameValue(map.has(sym), true, "`map.has(sym)` returns `true`"); +assert.sameValue(map.get(sym), 1, "`map.get(sym)` returns `1`"); +assert.sameValue(map.delete(sym), true, "`map.delete(sym)` returns `true`"); +assert.sameValue(map.size, 0, "The value of `map.size` is `0`"); + diff --git a/test/built-ins/Map/symbol-species.js b/test/built-ins/Map/symbol-species.js new file mode 100644 index 000000000..ca9742b71 --- /dev/null +++ b/test/built-ins/Map/symbol-species.js @@ -0,0 +1,18 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: > + Map has a property at `Symbol.species` +es6id: 23.1.2.2 +author: Sam Mikes +description: Map[Symbol.species] exists per spec +includes: + - propertyHelper.js +---*/ + +assert.sameValue(Map[Symbol.species], Map, "Map[Symbol.species] is Map"); + +verifyNotWritable(Map, Symbol.species, Symbol.species); +verifyNotEnumerable(Map, Symbol.species); +verifyConfigurable(Map, Symbol.species); -- cgit v1.2.1