Debian Codegraph @

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