Debian Codegraph @

js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.10_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 = 110xxxxx (n = 2) and string.charAt(k + 4) and
7 string.charAt(k + 5) do not represent hexadecimal digits, throw URIError
8 esid: sec-decodeuri-encodeduri
9 description: Complex tests
10 ---*/
11
12 //CHECK
13 var result = true;
14 var interval = [
15 [0x00, 0x2F],
16 [0x3A, 0x40],
17 [0x47, 0x60],
18 [0x67, 0xFFFF]
19 ];
20 for (var indexI = 0; indexI < interval.length; indexI++) {
21 for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) {
22 try {
23 decodeURI("%C0%" + String.fromCharCode(indexJ, indexJ));
24 result = false;
25 } catch (e) {
26 if ((e instanceof URIError) !== true) {
27 result = false;
28 }
29 }
30 }
31 }
32
33 if (result !== true) {
34 throw new Test262Error('#1: If B = 110xxxxx (n = 2) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError');
35 }
36
37 reportCompare(0, 0);