1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_2/function/regexparg-1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 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: regexparg-1.js 1.12 + Description: 1.13 + 1.14 + Regression test for 1.15 + http://scopus/bugsplat/show_bug.cgi?id=122787 1.16 + Passing a regular expression as the first constructor argument fails 1.17 + 1.18 + Author: christine@netscape.com 1.19 + Date: 15 June 1998 1.20 +*/ 1.21 + 1.22 +var SECTION = "JS_1.2"; 1.23 +var VERSION = "JS_1.2"; 1.24 +startTest(); 1.25 +var TITLE = "The variable statement"; 1.26 + 1.27 +writeHeaderToLog( SECTION + " "+ TITLE); 1.28 + 1.29 +print("Note: Bug 61911 changed the behavior of typeof regexp in Gecko 1.9."); 1.30 +print("Prior to Gecko 1.9, typeof regexp returned 'function'."); 1.31 +print("However in Gecko 1.9 and later, typeof regexp will return 'object'."); 1.32 + 1.33 +function f(x) {return x;} 1.34 + 1.35 +x = f(/abc/); 1.36 + 1.37 +new TestCase( SECTION, 1.38 + "function f(x) {return x;}; f()", 1.39 + void 0, 1.40 + f() ); 1.41 + 1.42 +new TestCase( SECTION, 1.43 + "f(\"hi\")", 1.44 + "hi", 1.45 + f("hi") ); 1.46 + 1.47 +new TestCase( SECTION, 1.48 + "new f(/abc/) +''", 1.49 + "/abc/", 1.50 + new f(/abc/) +"" ); 1.51 + 1.52 +new TestCase( SECTION, 1.53 + "f(/abc/)+'')", 1.54 + "/abc/", 1.55 + f(/abc/) +''); 1.56 + 1.57 +new TestCase( SECTION, 1.58 + "typeof f(/abc/)", 1.59 + "object", 1.60 + typeof f(/abc/) ); 1.61 + 1.62 +new TestCase( SECTION, 1.63 + "typeof new f(/abc/)", 1.64 + "object", 1.65 + typeof new f(/abc/) ); 1.66 + 1.67 +new TestCase( SECTION, 1.68 + "x = new f(/abc/); x.exec(\"hi\")", 1.69 + null, 1.70 + x.exec("hi") ); 1.71 + 1.72 + 1.73 +// js> x() 1.74 +test();