JDK-8008448.js revision 104:b632446ba138
1652Sjkh/* 233473Sscrappy * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3139825Simp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4139825Simp * 5139825Simp * This code is free software; you can redistribute it and/or modify it 6162588Snetchild * under the terms of the GNU General Public License version 2 only, as 733473Sscrappy * published by the Free Software Foundation. 8652Sjkh * 9652Sjkh * This code is distributed in the hope that it will be useful, but WITHOUT 10652Sjkh * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11652Sjkh * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12652Sjkh * version 2 for more details (a copy is included in the LICENSE file that 13652Sjkh * accompanied this code). 1433473Sscrappy * 1533473Sscrappy * You should have received a copy of the GNU General Public License version 1633473Sscrappy * 2 along with this work; if not, write to the Free Software Foundation, 1733473Sscrappy * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18652Sjkh * 1933473Sscrappy * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2033473Sscrappy * or visit www.oracle.com if you need additional information or have any 2133473Sscrappy * questions. 2233473Sscrappy */ 2333473Sscrappy 2433473Sscrappy/** 2533473Sscrappy * JDK-8008448: Add coverage test for jdk.nashorn.internal.ir.debug.JSONWriter 2633473Sscrappy * Ensure that all parseable files can be parsed using parser API. 2733473Sscrappy * 2833473Sscrappy * @test 2933473Sscrappy * @option -scripting 3033473Sscrappy * @run 3150734Speter */ 3250734Speter 33652Sjkhvar File = Java.type("java.io.File"); 34652Sjkhvar FilenameFilter = Java.type("java.io.FilenameFilter"); 35162588Snetchildvar Source = Java.type("jdk.nashorn.internal.runtime.Source") 36162588Snetchild 37162588Snetchild// Filter out non .js files 38162588Snetchildvar files = new File(__DIR__).listFiles(new FilenameFilter() { 39162588Snetchild accept: function(f, n) { return n.endsWith(".js") } 40162588Snetchild}); 4150906Sdfr 4250906Sdfr// load parser API 4365335Scgload("nashorn:parser.js"); 44652Sjkh 4565335Scg// parse each file to make sure it does not result in exception 4613765Smppfor each (var f in files) { 47652Sjkh parse(new Source(f.toString(), f).getString()); 48652Sjkh} 49652Sjkh