hannesw@1336: /* hannesw@1336: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. hannesw@1336: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1336: * hannesw@1336: * This code is free software; you can redistribute it and/or modify it hannesw@1336: * under the terms of the GNU General Public License version 2 only, as hannesw@1336: * published by the Free Software Foundation. hannesw@1336: * hannesw@1336: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1336: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1336: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1336: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1336: * accompanied this code). hannesw@1336: * hannesw@1336: * You should have received a copy of the GNU General Public License version hannesw@1336: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1336: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1336: * hannesw@1336: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1336: * or visit www.oracle.com if you need additional information or have any hannesw@1336: * questions. hannesw@1336: */ hannesw@1336: hannesw@1336: /** hannesw@1336: * JDK-8066407: Function with same body not reparsed after SyntaxError hannesw@1336: * hannesw@1336: * @test hannesw@1336: * @run hannesw@1336: */ hannesw@1336: hannesw@1336: function testFunction(body) { hannesw@1336: try { hannesw@1336: Function(body); hannesw@1336: Assert.fail("Should have thrown"); hannesw@1336: } catch (e) { hannesw@1336: Assert.assertEquals(e.name, "SyntaxError"); hannesw@1336: count++; hannesw@1336: } hannesw@1336: hannesw@1336: } hannesw@1336: hannesw@1336: var count = 0; hannesw@1336: hannesw@1336: testFunction("/a/r"); hannesw@1336: testFunction("/a/r"); hannesw@1336: testFunction("/a/r"); hannesw@1336: hannesw@1336: Assert.assertTrue(count === 3);