hannesw@59: /* hannesw@59: * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. hannesw@59: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@59: * hannesw@59: * This code is free software; you can redistribute it and/or modify it hannesw@59: * under the terms of the GNU General Public License version 2 only, as hannesw@59: * published by the Free Software Foundation. hannesw@59: * hannesw@59: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@59: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@59: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@59: * version 2 for more details (a copy is included in the LICENSE file that hannesw@59: * accompanied this code). hannesw@59: * hannesw@59: * You should have received a copy of the GNU General Public License version hannesw@59: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@59: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@59: * hannesw@59: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@59: * or visit www.oracle.com if you need additional information or have any hannesw@59: * questions. hannesw@59: */ hannesw@59: hannesw@59: /** hannesw@59: * Conversion of ConsString to String hannesw@59: * hannesw@59: * @test hannesw@59: * @run hannesw@59: */ hannesw@59: hannesw@59: var list = new java.util.ArrayList(); hannesw@59: var str = "foo"; hannesw@59: hannesw@59: list.add(str); // plain string hannesw@59: list.add(String(str + "1")); // String() called as function hannesw@59: list.add(String(new String(str + "2"))); // String() called as function with String object hannesw@59: list.add((str + "3").toString()); // toString() called on primitive string hannesw@59: list.add(new String(str + "4").toString()); // toString() called on String object hannesw@59: sundar@136: Packages.jdk.nashorn.test.models.StringArgs.checkString(list);