Debian Codegraph @

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