1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16var test_symbol = Symbol ('Test'); 17 18var obj = {}; 19 20assert ((test_symbol in obj) === false); 21 22obj[test_symbol] = 'value'; 23 24assert ((test_symbol in obj) === true); 25assert (obj[test_symbol] === 'value'); 26 27 28var array = []; 29 30assert ((test_symbol in array) === false); 31 32array[test_symbol] = 'value'; 33 34assert ((test_symbol in array) === true); 35assert (array[test_symbol] === 'value'); 36 37 38assert ((test_symbol in Symbol) === false); 39 40try { 41 test_symbol in test_symbol; 42 assert (false); 43} catch (ex) { 44 assert (ex instanceof TypeError); 45} 46 47try { 48 test_symbol in 3; 49 assert (false); 50} catch (ex) { 51 assert (ex instanceof TypeError); 52} 53 54try { 55 test_symbol in 'Test'; 56 assert (false); 57} catch (ex) { 58 assert (ex instanceof TypeError); 59} 60