| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = 'script-001.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: script-001.js |
| 10 | Section: |
| 11 | Description: new NativeScript object |
| 12 | |
| 13 | |
| 14 | js> parseInt(123,"hi") |
| 15 | 123 |
| 16 | js> parseInt(123, "blah") |
| 17 | 123 |
| 18 | js> s |
| 19 | js: s is not defined |
| 20 | js> s = new Script |
| 21 | |
| 22 | undefined; |
| 23 | |
| 24 | |
| 25 | js> s = new Script() |
| 26 | |
| 27 | undefined; |
| 28 | |
| 29 | |
| 30 | js> s.getJSClass |
| 31 | js> s.getJSClass = Object.prototype.toString |
| 32 | function toString() { |
| 33 | [native code] |
| 34 | } |
| 35 | |
| 36 | js> s.getJSClass() |
| 37 | [object Script] |
| 38 | js> s.compile( "return 3+4" ) |
| 39 | js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr |
| 40 | js> s.compile( "3+4" ) |
| 41 | |
| 42 | 3 + 4; |
| 43 | |
| 44 | |
| 45 | js> typeof s |
| 46 | function |
| 47 | js> s() |
| 48 | Jit failure! |
| 49 | invalid opcode: 1 |
| 50 | Jit Pass1 Failure! |
| 51 | javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V |
| 52 | An internal JIT error has occurred. Please report this with .class |
| 53 | [email protected] |
| 54 | |
| 55 | 7 |
| 56 | js> s.compile("3+4") |
| 57 | |
| 58 | 3 + 4; |
| 59 | |
| 60 | |
| 61 | js> s() |
| 62 | Jit failure! |
| 63 | invalid opcode: 1 |
| 64 | Jit Pass1 Failure! |
| 65 | javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V |
| 66 | An internal JIT error has occurred. Please report this with .class |
| 67 | [email protected] |
| 68 | |
| 69 | 7 |
| 70 | js> quit() |
| 71 | |
| 72 | C:\src\ns_priv\js\tests\ecma>shell |
| 73 | |
| 74 | C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; |
| 75 | :\src\ns_priv\js\tests javax.javascript.examples.Shell |
| 76 | Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 |
| 77 | Copyright (C) 1996-97 Symantec Corporation |
| 78 | |
| 79 | js> s = new Script("3+4") |
| 80 | |
| 81 | 3 + 4; |
| 82 | |
| 83 | |
| 84 | js> s() |
| 85 | 7 |
| 86 | js> s2 = new Script(); |
| 87 | |
| 88 | undefined; |
| 89 | |
| 90 | |
| 91 | js> s.compile( "3+4") |
| 92 | |
| 93 | 3 + 4; |
| 94 | |
| 95 | |
| 96 | js> s() |
| 97 | Jit failure! |
| 98 | invalid opcode: 1 |
| 99 | Jit Pass1 Failure! |
| 100 | javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V |
| 101 | An internal JIT error has occurred. Please report this with .class |
| 102 | [email protected] |
| 103 | |
| 104 | 7 |
| 105 | js> quit() |
| 106 | Author: [email protected] |
| 107 | Date: 12 november 1997 |
| 108 | */ |
| 109 | |
| 110 | var SECTION = "script-001"; |
| 111 | var VERSION = "JS1_3"; |
| 112 | var TITLE = "NativeScript"; |
| 113 | |
| 114 | startTest(); |
| 115 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 116 | |
| 117 | if (typeof Script == 'undefined') |
| 118 | { |
| 119 | print('Test skipped. Script not defined.'); |
| 120 | new TestCase( SECTION, |
| 121 | "var s = new Script(); typeof s", |
| 122 | "Script not supported, test skipped.", |
| 123 | "Script not supported, test skipped." ); |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | var s = new Script(); |
| 128 | s.getJSClass = Object.prototype.toString; |
| 129 | |
| 130 | new TestCase( SECTION, |
| 131 | "var s = new Script(); typeof s", |
| 132 | "function", |
| 133 | typeof s ); |
| 134 | |
| 135 | new TestCase( SECTION, |
| 136 | "s.getJSClass()", |
| 137 | "[object Script]", |
| 138 | s.getJSClass() ); |
| 139 | } |
| 140 | |
| 141 | test(); |