NASHORN-163.js revision 877:cf4d2252d444
172208Sasmodai/*
272208Sasmodai * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
372208Sasmodai * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
472208Sasmodai *
572208Sasmodai * This code is free software; you can redistribute it and/or modify it
672208Sasmodai * under the terms of the GNU General Public License version 2 only, as
772208Sasmodai * published by the Free Software Foundation.
872208Sasmodai *
972208Sasmodai * This code is distributed in the hope that it will be useful, but WITHOUT
1072277Sache * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1172329Sache * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1272208Sasmodai * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24/**
25 * NASHORN-163 :  Object.keys(o) should only enumerate o's own properties
26 *
27 * @test
28 * @run
29 */
30
31print(Object.keys({0:'a'}));
32print(Object.keys({0:'a',26:'z'}));
33
34print(Object.keys(['a']));
35print(Object.keys(['a','b',,,'z']));
36
37print(Object.getOwnPropertyNames({0:'a'}));
38print(Object.getOwnPropertyNames({0:'a',26:'z'}));
39
40print(Object.getOwnPropertyNames(['a']));
41print(Object.getOwnPropertyNames(['a','b',,,'z']));
42