Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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: hexadecimal.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: \\x# (hex) '; |
michael@0 | 19 | |
michael@0 | 20 | writeHeaderToLog('Executing script: hexadecimal.js'); |
michael@0 | 21 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 22 | |
michael@0 | 23 | var testPattern = '\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A'; |
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 = '\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A'; |
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 = '\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33'; |
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 = '\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40'; |
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 = '\\x7B\\x7C\\x7D\\x7E'; |
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-\\x5A]+'))", |
michael@0 | 65 | String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\x5A]+')))); |
michael@0 | 66 | |
michael@0 | 67 | new TestCase ( SECTION, |
michael@0 | 68 | "'canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))", |
michael@0 | 69 | String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+')))); |
michael@0 | 70 | |
michael@0 | 71 | new TestCase ( SECTION, |
michael@0 | 72 | "'canthisbeFOUND'.match(/[\\x61-\\x7A]+/)", |
michael@0 | 73 | String(["canthisbe"]), String('canthisbeFOUND'.match(/[\x61-\x7A]+/))); |
michael@0 | 74 | |
michael@0 | 75 | test(); |