| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'regexparg-1.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
var SECTION = "JS_1.2"; |
| 21 |
var VERSION = "JS_1.2"; |
| 22 |
startTest(); |
| 23 |
var TITLE = "The variable statement"; |
| 24 |
|
| 25 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 26 |
|
| 27 |
print("Note: Bug 61911 changed the behavior of typeof regexp in Gecko 1.9."); |
| 28 |
print("Prior to Gecko 1.9, typeof regexp returned 'function'."); |
| 29 |
print("However in Gecko 1.9 and later, typeof regexp will return 'object'."); |
| 30 |
|
| 31 |
function f(x) {return x;} |
| 32 |
|
| 33 |
x = f(/abc/); |
| 34 |
|
| 35 |
new TestCase( SECTION, |
| 36 |
"function f(x) {return x;}; f()", |
| 37 |
void 0, |
| 38 |
f() ); |
| 39 |
|
| 40 |
new TestCase( SECTION, |
| 41 |
"f(\"hi\")", |
| 42 |
"hi", |
| 43 |
f("hi") ); |
| 44 |
|
| 45 |
new TestCase( SECTION, |
| 46 |
"new f(/abc/) +''", |
| 47 |
"/abc/", |
| 48 |
new f(/abc/) +"" ); |
| 49 |
|
| 50 |
new TestCase( SECTION, |
| 51 |
"f(/abc/)+'')", |
| 52 |
"/abc/", |
| 53 |
f(/abc/) +''); |
| 54 |
|
| 55 |
new TestCase( SECTION, |
| 56 |
"typeof f(/abc/)", |
| 57 |
"object", |
| 58 |
typeof f(/abc/) ); |
| 59 |
|
| 60 |
new TestCase( SECTION, |
| 61 |
"typeof new f(/abc/)", |
| 62 |
"object", |
| 63 |
typeof new f(/abc/) ); |
| 64 |
|
| 65 |
new TestCase( SECTION, |
| 66 |
"x = new f(/abc/); x(\"hi\")", |
| 67 |
null, |
| 68 |
x("hi") ); |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
test(); |