Debian Codegraph @

js/src/tests/test262/built-ins/RegExp/S15.10.2.12_A4_T5.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 all characters not
7 included in the set returned by CharacterClassEscape :: w
8 es5id: 15.10.2.12_A4_T5
9 description: non-w
10 ---*/
11
12 var non_w = "\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"';
13 var regexp_W = /\W/g;
14 var k = 0;
15 while (regexp_W.exec(non_w) !== null) {
16 k++;
17 }
18
19 assert.sameValue(non_w.length, k, 'The value of non_w.length is expected to equal the value of k');
20
21 var non_W = "_0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
22
23 assert.sameValue(
24 /\W/.exec(non_W),
25 null,
26 '/W/.exec(""_0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"") must return null'
27 );
28
29 reportCompare(0, 0);