NASHORN-417.js revision 6:5a1b0714df0e
148981Ssheldonh/* 248981Ssheldonh * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 348981Ssheldonh * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 448981Ssheldonh * 548981Ssheldonh * This code is free software; you can redistribute it and/or modify it 648981Ssheldonh * under the terms of the GNU General Public License version 2 only, as 748981Ssheldonh * published by the Free Software Foundation. 848981Ssheldonh * 948981Ssheldonh * This code is distributed in the hope that it will be useful, but WITHOUT 1048981Ssheldonh * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1148981Ssheldonh * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1248981Ssheldonh * version 2 for more details (a copy is included in the LICENSE file that 1348981Ssheldonh * accompanied this code). 1448981Ssheldonh * 1548981Ssheldonh * You should have received a copy of the GNU General Public License version 1648981Ssheldonh * 2 along with this work; if not, write to the Free Software Foundation, 1748981Ssheldonh * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1848981Ssheldonh * 1948981Ssheldonh * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2048981Ssheldonh * or visit www.oracle.com if you need additional information or have any 2148981Ssheldonh * questions. 2248981Ssheldonh */ 2348981Ssheldonh 2448981Ssheldonh/** 2548981Ssheldonh * NASHORN-417 : Accessor descriptor property with undefined getter and setter is reported as data descriptor property 2648981Ssheldonh * 2748981Ssheldonh * @test 2848981Ssheldonh * @run 2950479Speter */ 3048981Ssheldonh 3148981Ssheldonhvar obj = {}; 3248981SsheldonhObject.defineProperty(obj, "foo", { 3348981Ssheldonh get: undefined, set: undefined }); 3478356Sdwmalone 35101474Sumevar desc = Object.getOwnPropertyDescriptor(obj, "foo"); 3648981Ssheldonhif (! ('get' in desc)) { 3748981Ssheldonh fail("#1 desc does not have 'get'"); 3848981Ssheldonh} 3948981Ssheldonh 4048981Ssheldonhif (! ('set' in desc)) { 4148981Ssheldonh fail("#2 desc does not have 'set'"); 4248981Ssheldonh} 4348981Ssheldonh 4448981Ssheldonhif ('value' in desc) { 4548981Ssheldonh fail("#3 desc has 'value'"); 4648981Ssheldonh} 4756590Sshin 4848981Ssheldonh