| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'compile.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; |
| 17 |
var VERSION = 'no version'; |
| 18 |
startTest(); |
| 19 |
var TITLE = 'RegExp: compile'; |
| 20 |
|
| 21 |
writeHeaderToLog('Executing script: compile.js'); |
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
var regularExpression = new RegExp(); |
| 25 |
|
| 26 |
regularExpression.compile("[0-9]{3}x[0-9]{4}","i"); |
| 27 |
|
| 28 |
new TestCase ( SECTION, |
| 29 |
"(compile '[0-9]{3}x[0-9]{4}','i')", |
| 30 |
String(["456X7890"]), String('234X456X7890'.match(regularExpression))); |
| 31 |
|
| 32 |
new TestCase ( SECTION, |
| 33 |
"source of (compile '[0-9]{3}x[0-9]{4}','i')", |
| 34 |
"[0-9]{3}x[0-9]{4}", regularExpression.source); |
| 35 |
|
| 36 |
new TestCase ( SECTION, |
| 37 |
"global of (compile '[0-9]{3}x[0-9]{4}','i')", |
| 38 |
false, regularExpression.global); |
| 39 |
|
| 40 |
new TestCase ( SECTION, |
| 41 |
"ignoreCase of (compile '[0-9]{3}x[0-9]{4}','i')", |
| 42 |
true, regularExpression.ignoreCase); |
| 43 |
|
| 44 |
regularExpression.compile("[0-9]{3}X[0-9]{3}","g"); |
| 45 |
|
| 46 |
new TestCase ( SECTION, |
| 47 |
"(compile '[0-9]{3}X[0-9]{3}','g')", |
| 48 |
String(["234X456"]), String('234X456X7890'.match(regularExpression))); |
| 49 |
|
| 50 |
new TestCase ( SECTION, |
| 51 |
"source of (compile '[0-9]{3}X[0-9]{3}','g')", |
| 52 |
"[0-9]{3}X[0-9]{3}", regularExpression.source); |
| 53 |
|
| 54 |
new TestCase ( SECTION, |
| 55 |
"global of (compile '[0-9]{3}X[0-9]{3}','g')", |
| 56 |
true, regularExpression.global); |
| 57 |
|
| 58 |
new TestCase ( SECTION, |
| 59 |
"ignoreCase of (compile '[0-9]{3}X[0-9]{3}','g')", |
| 60 |
false, regularExpression.ignoreCase); |
| 61 |
|
| 62 |
|
| 63 |
test(); |