Debian Codegraph @

js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.1_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: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError
6 esid: sec-decodeuri-encodeduri
7 description: Complex tests
8 ---*/
9
10 var result = true;
11
12 //CHECK#1
13 try {
14 decodeURI("%");
15 result = false;
16 } catch (e) {
17 if ((e instanceof URIError) !== true) {
18 result = false;
19 }
20 }
21
22 //CHECK#2
23 try {
24 decodeURI("%A");
25 result = false;
26 } catch (e) {
27 if ((e instanceof URIError) !== true) {
28 result = false;
29 }
30 }
31
32 //CHECK#3
33 try {
34 decodeURI("%1");
35 result = false;
36 } catch (e) {
37 if ((e instanceof URIError) !== true) {
38 result = false;
39 }
40 }
41
42 //CHECK#4
43 try {
44 decodeURI("% ");
45 result = false;
46 } catch (e) {
47 if ((e instanceof URIError) !== true) {
48 result = false;
49 }
50 }
51
52 if (result !== true) {
53 throw new Test262Error('#1: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError');
54 }
55
56 reportCompare(0, 0);