js/src/tests/js1_2/regexp/octal.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 Filename: octal.js
michael@0 9 Description: 'Tests regular expressions containing \<number> '
michael@0 10
michael@0 11 Author: Nick Lerissa
michael@0 12 Date: March 10, 1998
michael@0 13 */
michael@0 14
michael@0 15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
michael@0 16 var VERSION = 'no version';
michael@0 17 startTest();
michael@0 18 var TITLE = 'RegExp: \# (octal) ';
michael@0 19
michael@0 20 writeHeaderToLog('Executing script: octal.js');
michael@0 21 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 22
michael@0 23 var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132';
michael@0 24
michael@0 25 var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
michael@0 26
michael@0 27 new TestCase ( SECTION,
michael@0 28 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
michael@0 29 String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
michael@0 30
michael@0 31 testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172';
michael@0 32
michael@0 33 testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
michael@0 34
michael@0 35 new TestCase ( SECTION,
michael@0 36 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
michael@0 37 String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
michael@0 38
michael@0 39 testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63';
michael@0 40
michael@0 41 testString = "abc !\"#$%&'()*+,-./0123ZBC";
michael@0 42
michael@0 43 new TestCase ( SECTION,
michael@0 44 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
michael@0 45 String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
michael@0 46
michael@0 47 testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100';
michael@0 48
michael@0 49 testString = "123456789:;<=>?@ABC";
michael@0 50
michael@0 51 new TestCase ( SECTION,
michael@0 52 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
michael@0 53 String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
michael@0 54
michael@0 55 testPattern = '\\173\\174\\175\\176';
michael@0 56
michael@0 57 testString = "1234{|}~ABC";
michael@0 58
michael@0 59 new TestCase ( SECTION,
michael@0 60 "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
michael@0 61 String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
michael@0 62
michael@0 63 new TestCase ( SECTION,
michael@0 64 "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))",
michael@0 65 String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+'))));
michael@0 66
michael@0 67 new TestCase ( SECTION,
michael@0 68 "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))",
michael@0 69 String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))));
michael@0 70
michael@0 71 new TestCase ( SECTION,
michael@0 72 "'canthisbeFOUND'.match(/[\\141-\\172]+/)",
michael@0 73 String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/)));
michael@0 74
michael@0 75 test();

mercurial