test/script/basic/JDK-8075927.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1269
7c42bc7769ce
permissions
-rw-r--r--

Merge

hannesw@1269 1 /*
hannesw@1269 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
hannesw@1269 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1269 4 *
hannesw@1269 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1269 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1269 7 * published by the Free Software Foundation.
hannesw@1269 8 *
hannesw@1269 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1269 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1269 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1269 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1269 13 * accompanied this code).
hannesw@1269 14 *
hannesw@1269 15 * You should have received a copy of the GNU General Public License version
hannesw@1269 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1269 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1269 18 *
hannesw@1269 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1269 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1269 21 * questions.
hannesw@1269 22 */
hannesw@1269 23
hannesw@1269 24 /**
hannesw@1269 25 * JDK-8075927: toNumber(String) accepts illegal characters
hannesw@1269 26 *
hannesw@1269 27 * @test
hannesw@1269 28 * @run
hannesw@1269 29 */
hannesw@1269 30
hannesw@1269 31 Assert.assertTrue(isNaN(Number("-123d")));
hannesw@1269 32 Assert.assertTrue(isNaN(Number("-123f")));
hannesw@1269 33 Assert.assertTrue(Number(" 123 ") === 123);
hannesw@1269 34 Assert.assertTrue(Number(" -123 ") === -123);
hannesw@1269 35 Assert.assertEquals(Number(" Infinity "), Infinity);
hannesw@1269 36 Assert.assertEquals(Number(" +Infinity "), Infinity);
hannesw@1269 37 Assert.assertEquals(Number(" -Infinity "), -Infinity);
hannesw@1269 38

mercurial