1/* The contents of this file are subject to the Netscape Public 2 * License Version 1.1 (the "License"); you may not use this file 3 * except in compliance with the License. You may obtain a copy of 4 * the License at http://www.mozilla.org/NPL/ 5 * 6 * Software distributed under the License is distributed on an "AS 7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 8 * implied. See the License for the specific language governing 9 * rights and limitations under the License. 10 * 11 * The Original Code is Mozilla Communicator client code, released March 12 * 31, 1998. 13 * 14 * The Initial Developer of the Original Code is Netscape Communications 15 * Corporation. Portions created by Netscape are 16 * Copyright (C) 1998 Netscape Communications Corporation. All 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 */ 22/** 23 Filename: RegExp_dollar_number.js 24 Description: 'Tests RegExps $1, ..., $9 properties' 25 26 Author: Nick Lerissa 27 Date: March 12, 1998 28*/ 29 30 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; 31 var VERSION = 'no version'; 32 startTest(); 33 var TITLE = 'RegExp: $1, ..., $9'; 34 var BUGNUMBER="123802"; 35 36 writeHeaderToLog('Executing script: RegExp_dollar_number.js'); 37 writeHeaderToLog( SECTION + " "+ TITLE); 38 39 var count = 0; 40 var testcases = new Array(); 41 42 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1 43 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); 44 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1", 45 'abcdefghi', RegExp.$1); 46 47 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2 48 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2", 49 'bcdefgh', RegExp.$2); 50 51 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3 52 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3", 53 'cdefg', RegExp.$3); 54 55 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4 56 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4", 57 'def', RegExp.$4); 58 59 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5 60 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5", 61 'e', RegExp.$5); 62 63 // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6 64 testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6", 65 '', RegExp.$6); 66 67 var a_to_z = 'abcdefghijklmnopqrstuvwxyz'; 68 var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/ 69 // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1 70 a_to_z.match(regexp1); 71 72 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1", 73 'a', RegExp.$1); 74 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2", 75 'c', RegExp.$2); 76 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3", 77 'e', RegExp.$3); 78 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4", 79 'g', RegExp.$4); 80 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5", 81 'i', RegExp.$5); 82 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6", 83 'k', RegExp.$6); 84 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7", 85 'm', RegExp.$7); 86 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8", 87 'o', RegExp.$8); 88 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9", 89 'q', RegExp.$9); 90/* 91 testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10", 92 's', RegExp.$10); 93*/ 94 function test() 95 { 96 for ( tc=0; tc < testcases.length; tc++ ) { 97 testcases[tc].passed = writeTestCaseResult( 98 testcases[tc].expect, 99 testcases[tc].actual, 100 testcases[tc].description +" = "+ 101 testcases[tc].actual ); 102 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; 103 } 104 stopTest(); 105 return ( testcases ); 106 } 107 108 test(); 109