1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_3/extensions/script-001.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,140 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: script-001.js 1.12 + Section: 1.13 + Description: new NativeScript object 1.14 + 1.15 + 1.16 + js> parseInt(123,"hi") 1.17 + 123 1.18 + js> parseInt(123, "blah") 1.19 + 123 1.20 + js> s 1.21 + js: s is not defined 1.22 + js> s = new Script 1.23 + 1.24 + undefined; 1.25 + 1.26 + 1.27 + js> s = new Script() 1.28 + 1.29 + undefined; 1.30 + 1.31 + 1.32 + js> s.getJSClass 1.33 + js> s.getJSClass = Object.prototype.toString 1.34 + function toString() { 1.35 + [native code] 1.36 + } 1.37 + 1.38 + js> s.getJSClass() 1.39 + [object Script] 1.40 + js> s.compile( "return 3+4" ) 1.41 + js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr 1.42 + js> s.compile( "3+4" ) 1.43 + 1.44 + 3 + 4; 1.45 + 1.46 + 1.47 + js> typeof s 1.48 + function 1.49 + js> s() 1.50 + Jit failure! 1.51 + invalid opcode: 1 1.52 + Jit Pass1 Failure! 1.53 + javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V 1.54 + An internal JIT error has occurred. Please report this with .class 1.55 + jit-bugs@itools.symantec.com 1.56 + 1.57 + 7 1.58 + js> s.compile("3+4") 1.59 + 1.60 + 3 + 4; 1.61 + 1.62 + 1.63 + js> s() 1.64 + Jit failure! 1.65 + invalid opcode: 1 1.66 + Jit Pass1 Failure! 1.67 + javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V 1.68 + An internal JIT error has occurred. Please report this with .class 1.69 + jit-bugs@itools.symantec.com 1.70 + 1.71 + 7 1.72 + js> quit() 1.73 + 1.74 + C:\src\ns_priv\js\tests\ecma>shell 1.75 + 1.76 + C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; 1.77 + :\src\ns_priv\js\tests javax.javascript.examples.Shell 1.78 + Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 1.79 + Copyright (C) 1996-97 Symantec Corporation 1.80 + 1.81 + js> s = new Script("3+4") 1.82 + 1.83 + 3 + 4; 1.84 + 1.85 + 1.86 + js> s() 1.87 + 7 1.88 + js> s2 = new Script(); 1.89 + 1.90 + undefined; 1.91 + 1.92 + 1.93 + js> s.compile( "3+4") 1.94 + 1.95 + 3 + 4; 1.96 + 1.97 + 1.98 + js> s() 1.99 + Jit failure! 1.100 + invalid opcode: 1 1.101 + Jit Pass1 Failure! 1.102 + javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V 1.103 + An internal JIT error has occurred. Please report this with .class 1.104 + jit-bugs@itools.symantec.com 1.105 + 1.106 + 7 1.107 + js> quit() 1.108 + Author: christine@netscape.com 1.109 + Date: 12 november 1997 1.110 +*/ 1.111 + 1.112 +var SECTION = "script-001"; 1.113 +var VERSION = "JS1_3"; 1.114 +var TITLE = "NativeScript"; 1.115 + 1.116 +startTest(); 1.117 +writeHeaderToLog( SECTION + " "+ TITLE); 1.118 + 1.119 +if (typeof Script == 'undefined') 1.120 +{ 1.121 + print('Test skipped. Script not defined.'); 1.122 + new TestCase( SECTION, 1.123 + "var s = new Script(); typeof s", 1.124 + "Script not supported, test skipped.", 1.125 + "Script not supported, test skipped." ); 1.126 +} 1.127 +else 1.128 +{ 1.129 + var s = new Script(); 1.130 + s.getJSClass = Object.prototype.toString; 1.131 + 1.132 + new TestCase( SECTION, 1.133 + "var s = new Script(); typeof s", 1.134 + "function", 1.135 + typeof s ); 1.136 + 1.137 + new TestCase( SECTION, 1.138 + "s.getJSClass()", 1.139 + "[object Script]", 1.140 + s.getJSClass() ); 1.141 +} 1.142 + 1.143 +test();