| 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 all characters not |
| 7 |
included in the set returned by CharacterClassEscape :: w |
| 8 |
es5id: 15.10.2.12_A4_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 |
if (regexp_W.exec(String.fromCharCode(alpha)) !== null) { |
| 18 |
result = false; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
if (result !== true) { |
| 23 |
$ERROR('#1: 0 - 9'); |
| 24 |
} |
| 25 |
|
| 26 |
//CHECK#005F |
| 27 |
if (regexp_W.exec("_") !== null) { |
| 28 |
$ERROR('#2: _'); |
| 29 |
} |
| 30 |
|
| 31 |
//CHECK#0020 |
| 32 |
var arr = regexp_W.exec(" "); |
| 33 |
if ((arr === null) || (arr[0] !== "\u0020")) { |
| 34 |
$ERROR('#2: '); |
| 35 |
} |