initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma_2 / RegExp / function-001.js
1 /**
2  *  File Name:          RegExp/function-001.js
3  *  ECMA Section:       15.7.2.1
4  *  Description:        Based on ECMA 2 Draft 7 February 1999
5  *
6  *  Author:             christine@netscape.com
7  *  Date:               19 February 1999
8  */
9     var SECTION = "RegExp/function-001";
10     var VERSION = "ECMA_2";
11     var TITLE   = "RegExp( pattern, flags )";
12
13     startTest();
14
15     /*
16      * for each test case, verify:
17      * - verify that [[Class]] property is RegExp
18      * - prototype property should be set to RegExp.prototype
19      * - source is set to the empty string
20      * - global property is set to false
21      * - ignoreCase property is set to false
22      * - multiline property is set to false
23      * - lastIndex property is set to 0
24      */
25
26     RegExp.prototype.getClassProperty = Object.prototype.toString;
27     var re = new RegExp();
28
29     AddTestCase(
30         "new RegExp().__proto__",
31         RegExp.prototype,
32         re.__proto__
33     );
34
35     AddTestCase(
36         "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
37         "(new RegExp()).getClassProperty()",
38         "[object RegExp]",
39         re.getClassProperty() );
40
41     AddTestCase(
42         "(new RegExp()).source",
43         "",
44         re.source );
45
46     AddTestCase(
47         "(new RegExp()).global",
48         false,
49         re.global );
50
51     AddTestCase(
52         "(new RegExp()).ignoreCase",
53         false,
54         re.ignoreCase );
55
56     AddTestCase(
57         "(new RegExp()).multiline",
58         false,
59         re.multiline );
60
61     AddTestCase(
62         "(new RegExp()).lastIndex",
63         0,
64         re.lastIndex );
65
66     test()