| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'asterisk.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: *'; |
| 20 |
|
| 21 |
writeHeaderToLog('Executing script: aterisk.js'); |
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
|
| 25 |
new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('d*'))", |
| 26 |
String([""]), String('abcddddefg'.match(new RegExp('d*')))); |
| 27 |
|
| 28 |
|
| 29 |
new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('cd*'))", |
| 30 |
String(["cdddd"]), String('abcddddefg'.match(new RegExp('cd*')))); |
| 31 |
|
| 32 |
|
| 33 |
new TestCase ( SECTION, "'abcdefg'.match(new RegExp('cx*d'))", |
| 34 |
String(["cd"]), String('abcdefg'.match(new RegExp('cx*d')))); |
| 35 |
|
| 36 |
|
| 37 |
new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x*)(x+)'))", |
| 38 |
String(["xxxxxxx","xxxxxx","x"]), String('xxxxxxx'.match(new RegExp('(x*)(x+)')))); |
| 39 |
|
| 40 |
|
| 41 |
new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)(\\d+)'))", |
| 42 |
String(["1234567890","123456789","0"]), |
| 43 |
String('1234567890'.match(new RegExp('(\\d*)(\\d+)')))); |
| 44 |
|
| 45 |
|
| 46 |
new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))", |
| 47 |
String(["1234567890","12345678","0"]), |
| 48 |
String('1234567890'.match(new RegExp('(\\d*)\\d(\\d+)')))); |
| 49 |
|
| 50 |
|
| 51 |
new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x+)(x*)'))", |
| 52 |
String(["xxxxxxx","xxxxxxx",""]), String('xxxxxxx'.match(new RegExp('(x+)(x*)')))); |
| 53 |
|
| 54 |
|
| 55 |
new TestCase ( SECTION, "'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))", |
| 56 |
String(["xxxxxxyyyyyy"]), String('xxxxxxyyyyyy'.match(new RegExp('x*y+$')))); |
| 57 |
|
| 58 |
|
| 59 |
new TestCase ( SECTION, "'abcdef'.match(/[\\d]*[\\s]*bc./)", |
| 60 |
String(["bcd"]), String('abcdef'.match(/[\d]*[\s]*bc./))); |
| 61 |
|
| 62 |
|
| 63 |
new TestCase ( SECTION, "'abcdef'.match(/bc..[\\d]*[\\s]*/)", |
| 64 |
String(["bcde"]), String('abcdef'.match(/bc..[\d]*[\s]*/))); |
| 65 |
|
| 66 |
|
| 67 |
new TestCase ( SECTION, "'a1b2c3'.match(/.*/)", |
| 68 |
String(["a1b2c3"]), String('a1b2c3'.match(/.*/))); |
| 69 |
|
| 70 |
|
| 71 |
new TestCase ( SECTION, "'a0.b2.c3'.match(/[xyz]*1/)", |
| 72 |
null, 'a0.b2.c3'.match(/[xyz]*1/)); |
| 73 |
|
| 74 |
test(); |