JDK-8008448.js revision 798:f7f2e9d2912b
1255376Sdes/*
2255376Sdes * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
399158Sdes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
499158Sdes *
599158Sdes * This code is free software; you can redistribute it and/or modify it
699158Sdes * under the terms of the GNU General Public License version 2 only, as
799158Sdes * published by the Free Software Foundation.
899158Sdes *
999158Sdes * This code is distributed in the hope that it will be useful, but WITHOUT
1099158Sdes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1199158Sdes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12255376Sdes * version 2 for more details (a copy is included in the LICENSE file that
1399158Sdes * accompanied this code).
1499158Sdes *
15141098Sdes * You should have received a copy of the GNU General Public License version
16141098Sdes * 2 along with this work; if not, write to the Free Software Foundation,
1799158Sdes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1899158Sdes *
1999158Sdes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2099158Sdes * or visit www.oracle.com if you need additional information or have any
2199158Sdes * questions.
2299158Sdes */
2399158Sdes
2499158Sdes/**
2599158Sdes * JDK-8008448: Add coverage test for jdk.nashorn.internal.ir.debug.JSONWriter
2699158Sdes * Ensure that all parseable files can be parsed using parser API.
2799158Sdes *
2899158Sdes * @test
2999158Sdes * @option --const-as-var
3099158Sdes * @option -scripting
3199158Sdes * @run
32117610Sdes */
33117610Sdes
34147466Sdesvar File = Java.type("java.io.File");
3599158Sdesvar FilenameFilter = Java.type("java.io.FilenameFilter");
3699158Sdesvar SourceHelper = Java.type("jdk.nashorn.test.models.SourceHelper")
3799158Sdes
38236109Sdes// Filter out non .js files
39236109Sdesvar files = new File(__DIR__).listFiles(new FilenameFilter() {
40236109Sdes    accept: function(f, n) { return n.endsWith(".js") }
41});
42
43// load parser API
44load("nashorn:parser.js");
45
46// parse each file to make sure it does not result in exception
47for each (var f in files) {
48    parse(SourceHelper.readFully(f));
49}
50