JDK-8019985.js revision 877:cf4d2252d444
11899Swollman/* 21899Swollman * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 31899Swollman * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41899Swollman * 51899Swollman * This code is free software; you can redistribute it and/or modify it 61899Swollman * under the terms of the GNU General Public License version 2 only, as 71899Swollman * published by the Free Software Foundation. 81899Swollman * 91899Swollman * This code is distributed in the hope that it will be useful, but WITHOUT 101899Swollman * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111899Swollman * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 121899Swollman * version 2 for more details (a copy is included in the LICENSE file that 131899Swollman * accompanied this code). 141899Swollman * 15263142Seadler * You should have received a copy of the GNU General Public License version 161899Swollman * 2 along with this work; if not, write to the Free Software Foundation, 171899Swollman * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181899Swollman * 191899Swollman * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 201899Swollman * or visit www.oracle.com if you need additional information or have any 211899Swollman * questions. 221899Swollman */ 231899Swollman 241899Swollman/** 251899Swollman * JDK-8019985: Date.parse("2000-01-01T00:00:00.Z") should return NaN 261899Swollman * 271899Swollman * @test 281899Swollman * @run 291899Swollman */ 301899Swollman 311899Swollmanfunction testFail(str) { 3263248Speter if (!isNaN(Date.parse(str))) { 331899Swollman throw new Error("Parsed invalid date string: " + str); 34255760Sdes } 3571115Sru} 3671115Sru 3771115Srufunction testOk(str) { 3871115Sru if (isNaN(Date.parse(str))) { 39255760Sdes throw new Error("Failed to parse valid date string: " + str); 4071115Sru } 4171115Sru} 4271115Sru 4371115SrutestFail("2000-01-01T00:00:00.Z"); 4471115SrutestFail("2000-01-01T00:00:Z"); 4571115SrutestFail("2000-01-01T00:Z"); 4671115SrutestFail("2000-01-01T00Z"); 4771115SrutestOk("2000-01-01T00:00:00.000Z"); 4871115SrutestOk("2000-01-01T00:00:00.0Z"); 4971115SrutestOk("2000-01-01T00:00:00Z"); 50255760SdestestOk("2000-01-01T00:00Z"); 51255760Sdes