test/script/basic/consstring.js

Wed, 18 Jun 2014 12:35:42 -0700

author
katleman
date
Wed, 18 Jun 2014 12:35:42 -0700
changeset 863
6e9c4e34bc61
parent 136
c54e218333be
child 952
6d5471a497fb
permissions
-rw-r--r--

Added tag jdk8u20-b19 for changeset b047df215de4

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

mercurial