Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/RegExp/S15.10.2.12_A3_T3.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 The production CharacterClassEscape :: w evaluates by returning the set of characters containing the sixty-three characters:
7 a - z, A - Z, 0 - 9, _
8 es5id: 15.10.2.12_A3_T3
9 description: 0 - 9, _
10 ---*/
11
12 var regexp_w = /\w/;
13
14 //CHECK#0030-0039
15 var result = true;
16 for (var alpha = 0x0030; alpha <= 0x0039; alpha++) {
17 var str = String.fromCharCode(alpha);
18 var arr = regexp_w.exec(str);
19 if ((arr === null) || (arr[0] !== str)) {
20 result = false;
21 }
22 }
23
24 if (result !== true) {
25 $ERROR('#1: 0 - 9');
26 }
27
28 //CHECK#005F
29 var arr = regexp_w.exec("_");
30 if ((arr === null) || (arr[0] !== "\u005F")) {
31 $ERROR('#2: _');
32 }
33
34 //CHECK#0020
35 if (regexp_w.exec(" ") !== null) {
36 $ERROR('#3: ');
37 }