author | lagergren |
Fri, 27 Jun 2014 10:47:44 +0200 | |
changeset 25246 | 133774398ceb |
permissions | -rw-r--r-- |
25246
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
1 |
/* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
4 |
* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
8 |
* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
13 |
* accompanied this code). |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
14 |
* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
18 |
* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
21 |
* questions. |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
22 |
*/ |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
23 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
24 |
/** |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
25 |
* Read fully parameter test |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
26 |
* |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
27 |
* @test |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
28 |
* @option -scripting |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
29 |
* @run |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
30 |
*/ |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
31 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
32 |
var str = __FILE__; |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
33 |
var first = readFully(str); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
34 |
print(typeof str); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
35 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
36 |
var str2 = __FILE__.substring(0,5); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
37 |
var str3 = __FILE__.substring(5); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
38 |
print(typeof str2); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
39 |
print(typeof str3); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
40 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
41 |
var cons = str2 + str3; |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
42 |
print(typeof cons); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
43 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
44 |
var second = readFully(cons); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
45 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
46 |
var f = new java.io.File(str); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
47 |
print(typeof f); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
48 |
var third = readFully(f); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
49 |
|
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
50 |
print(first.length() == second.length()); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
51 |
print(first.length() == third.length()); |
133774398ceb
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
lagergren
parents:
diff
changeset
|
52 |