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