Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/decodeURIComponent/S15.1.3.2_A1.2_T1.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 If B = string.charAt(k+1) + string.charAt(k+2) do not represent
7 hexadecimal digits, throw URIError
8 es5id: 15.1.3.2_A1.2_T1
9 es6id: 18.2.6.3
10 esid: sec-decodeuricomponent-encodeduricomponent
11 description: Complex tests
12 ---*/
13
14 //CHECK
15 var result = true;
16 var interval = [
17 [0x00, 0x29],
18 [0x40, 0x40],
19 [0x47, 0x60],
20 [0x67, 0xFFFF]
21 ];
22 for (var indexI = 0; indexI < interval.length; indexI++) {
23 for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) {
24 try {
25 decodeURIComponent("%" + String.fromCharCode(indexJ) + "1");
26 result = false;
27 } catch (e) {
28 if ((e instanceof URIError) !== true) {
29 result = false;
30 }
31 }
32 }
33 }
34
35 if (result !== true) {
36 $ERROR('#1: If string.charAt(k+1) does not represent hexadecimal digits, throw URIError');
37 }