NASHORN-435.js revision 2:da1e581c933b
1275970Scy/*
2275970Scy * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
3316068Sdelphij * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4316068Sdelphij *
5275970Scy * This code is free software; you can redistribute it and/or modify it
6275970Scy * under the terms of the GNU General Public License version 2 only, as
7275970Scy * published by the Free Software Foundation.
8275970Scy *
9275970Scy * This code is distributed in the hope that it will be useful, but WITHOUT
10275970Scy * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11275970Scy * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12275970Scy * version 2 for more details (a copy is included in the LICENSE file that
13275970Scy * accompanied this code).
14275970Scy *
15316068Sdelphij * You should have received a copy of the GNU General Public License version
16275970Scy * 2 along with this work; if not, write to the Free Software Foundation,
17275970Scy * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18275970Scy *
19275970Scy * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20275970Scy * or visit www.oracle.com if you need additional information or have any
21275970Scy * questions.
22275970Scy */
23275970Scy
24275970Scy/**
25275970Scy * NASHORN-435 : Array iterator callback is not called for elements with undefined as value
26275970Scy *
27275970Scy * @test
28275970Scy * @run
29316068Sdelphij */
30275970Scy
31275970Scyvar arr = [ undefined ];
32275970Scyvar reachedCallback = false;
33275970Scyarr.forEach(function(kVal, k, obj) {
34275970Scy    reachedCallback = true;
35275970Scy});
36275970Scy
37275970Scyif (! reachedCallback) {
38275970Scy    fail("callback not called for element of 'undefined' value");
39275970Scy}
40275970Scy
41275970Scy