summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/encodeURI
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/encodeURI')
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T1.js55
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T2.js55
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T1.js57
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T2.js57
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.3_T1.js66
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.1_T1.js65
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.2_T1.js57
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.3_T1.js57
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T1.js69
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T2.js69
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.5_T1.js57
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.1_T1.js20
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T1.js20
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T2.js20
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.3_T1.js14
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T1.js25
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T2.js25
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T3.js30
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T4.js30
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.1.js27
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.2.js27
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.3.js18
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.4.js15
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.5.js27
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.6.js15
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.7.js23
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A6_T1.js129
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/name.js28
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/prop-desc.js18
-rw-r--r--js/src/tests/test262/built-ins/encodeURI/shell.js52
33 files changed, 1278 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T1.js
new file mode 100644
index 0000000000..6f394634ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T1.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
+esid: sec-encodeuri-uri
+description: Complex tests
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+for (var index = 0xDC00; index <= 0xDFFF; index++) {
+ count++;
+ try {
+ encodeURI(String.fromCharCode(index));
+ } catch (e) {
+ if ((e instanceof URIError) === true) continue;
+ }
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T2.js
new file mode 100644
index 0000000000..5d1cd70874
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.1_T2.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
+esid: sec-encodeuri-uri
+description: Complex tests
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+for (var index = 0xDC00; index <= 0xDFFF; index++) {
+ count++;
+ try {
+ encodeURI(String.fromCharCode(index, 0x0041));
+ } catch (e) {
+ if ((e instanceof URIError) === true) continue;
+ }
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T1.js
new file mode 100644
index 0000000000..c594546cb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T1.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw
+ URIError
+esid: sec-encodeuri-uri
+description: Complex tests
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+for (var index = 0xD800; index <= 0xDBFF; index++) {
+ count++;
+ try {
+ encodeURI(String.fromCharCode(index));
+ } catch (e) {
+ if ((e instanceof URIError) === true) continue;
+ }
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T2.js
new file mode 100644
index 0000000000..2b58ea2d4e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.2_T2.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw
+ URIError
+esid: sec-encodeuri-uri
+description: Complex tests
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+for (var index = 0xD800; index <= 0xDBFF; index++) {
+ count++;
+ try {
+ encodeURI(String.fromCharCode(0x0041, index));
+ } catch (e) {
+ if ((e instanceof URIError) === true) continue;
+ }
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.3_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.3_T1.js
new file mode 100644
index 0000000000..9435893ab7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A1.3_T1.js
@@ -0,0 +1,66 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) not in
+ [0xDC00 - 0xDFFF], throw URIError
+esid: sec-encodeuri-uri
+description: >
+ Complex tests, string.charAt(k+1) in [0x0000, 0xD7FF, 0xD800,
+ 0xDBFE, 0xDBFF, 0xE000, 0xFFFF]
+includes: [decimalToHexString.js]
+---*/
+
+var chars = [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF];
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+for (var index = 0xD800; index <= 0xDBFF; index++) {
+ count++;
+ var res = true;
+ for (var indexC = 0; indexC < chars.length; indexC++) {
+ try {
+ encodeURI(String.fromCharCode(index, chars[indexC]));
+ } catch (e) {
+ if ((e instanceof URIError) === true) continue;
+ }
+ res = false;
+ }
+ if (res !== true) {
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+ }
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.1_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.1_T1.js
new file mode 100644
index 0000000000..533cf4a40b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.1_T1.js
@@ -0,0 +1,65 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0x0000 - 0x007F]\[uriReserved, uriUnescaped, #],
+ return 1 octet (00000000 0zzzzzzz -> 0zzzzzzz)
+esid: sec-encodeuri-uri
+description: Complex tests, use RFC 3629
+includes: [decimalToHexString.js]
+---*/
+
+var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","];
+var uriUnescaped = ["-", "_", ".", "!", "~", "*", "'", "(", ")", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+
+l:
+ for (var index = 0x0000; index <= 0x007F; index++) {
+ count++;
+ var str = String.fromCharCode(index);
+ for (var indexC = 0; indexC < uriReserved.length; indexC++) {
+ if (uriReserved[indexC] === str) continue l;
+ }
+ for (indexC = 0; indexC < uriUnescaped.length; indexC++) {
+ if (uriUnescaped[indexC] === str) continue l;
+ }
+ if ("#" === str) continue l;
+ if (encodeURI(str).toUpperCase() === decimalToPercentHexString(index)) continue l;
+
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+ }
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.2_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.2_T1.js
new file mode 100644
index 0000000000..cf0ae8bc15
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.2_T1.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0x0080 - 0x07FF], return 2 octets (00000yyy
+ yyzzzzzz -> 110yyyyy 10zzzzzz)
+esid: sec-encodeuri-uri
+description: Complex tests, use RFC 3629
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+l:
+ for (var index = 0x0080; index <= 0x07FF; index++) {
+ count++;
+ var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
+ var hex2 = decimalToPercentHexString(0x00C0 + (index & 0x07C0) / 0x0040);
+ var str = String.fromCharCode(index);
+ if (encodeURI(str).toUpperCase() === hex2 + hex1) continue;
+
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+ }
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.3_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.3_T1.js
new file mode 100644
index 0000000000..7a27031f3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.3_T1.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0x0800 - 0xD7FF], return 3 octets (xxxxyyyy
+ yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
+esid: sec-encodeuri-uri
+description: Complex tests, use RFC 3629
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+for (var index = 0x0800; index <= 0xD7FF; index++) {
+ count++;
+ var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
+ var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
+ var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
+ var str = String.fromCharCode(index);
+ if (encodeURI(str).toUpperCase() === hex3 + hex2 + hex1) continue;
+
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T1.js
new file mode 100644
index 0000000000..f6a927bced
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T1.js
@@ -0,0 +1,69 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in
+ [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz ->
+ 11110www 10xxxxxx 10yyyyyy 10zzzzzz)
+esid: sec-encodeuri-uri
+description: >
+ Complex tests, use RFC 3629, string.charAt(k+1) in [0xDC00,
+ 0xDDFF, 0xDFFF]
+includes: [decimalToHexString.js]
+---*/
+
+var chars = [0xDC00, 0xDDFF, 0xDFFF];
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+for (var index = 0xD800; index <= 0xDBFF; index++) {
+ var res = true;
+ for (var indexC = 0; indexC < chars.length; indexC++) {
+ var index1 = (index - 0xD800) * 0x400 + (chars[indexC] - 0xDC00) + 0x10000;
+ var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
+ var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
+ var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
+ var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
+ var str = String.fromCharCode(index, chars[indexC]);
+ if (encodeURI(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
+
+ res = false;
+ }
+ if (res !== true) {
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+ }
+ count++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T2.js
new file mode 100644
index 0000000000..83beed604d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.4_T2.js
@@ -0,0 +1,69 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in
+ [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz ->
+ 11110www 10xxxxxx 10yyyyyy 10zzzzzz)
+esid: sec-encodeuri-uri
+description: >
+ Complex tests, use RFC 3629, string.charAt(k) in [0xD800, 0xDBFF,
+ 0xD9FF]
+includes: [decimalToHexString.js]
+---*/
+
+var chars = [0xD800, 0xDBFF, 0xD9FF];
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+for (var index = 0xDC00; index <= 0xDFFF; index++) {
+ var res = true;
+ for (var indexC = 0; indexC < chars.length; indexC++) {
+ var index1 = (chars[indexC] - 0xD800) * 0x400 + (index - 0xDC00) + 0x10000;
+ var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
+ var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
+ var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
+ var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
+ var str = String.fromCharCode(chars[indexC], index);
+ if (encodeURI(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
+
+ res = false;
+ }
+ if (res !== true) {
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+ }
+ count++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.5_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.5_T1.js
new file mode 100644
index 0000000000..0e19329273
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A2.5_T1.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If string.charAt(k) in [0xE000 - 0xFFFF], return 3 octets (xxxxyyyy
+ yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
+esid: sec-encodeuri-uri
+description: Complex tests, use RFC 3629
+includes: [decimalToHexString.js]
+---*/
+
+var errorCount = 0;
+var count = 0;
+var indexP;
+var indexO = 0;
+for (var index = 0xE000; index <= 0xFFFF; index++) {
+ count++;
+ var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
+ var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
+ var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
+ var str = String.fromCharCode(index);
+ if (encodeURI(str).toUpperCase() === hex3 + hex2 + hex1) continue;
+
+ if (indexO === 0) {
+ indexO = index;
+ } else {
+ if ((index - indexP) !== 1) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ }
+ else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ indexO = index;
+ }
+ }
+ indexP = index;
+ errorCount++;
+}
+
+if (errorCount > 0) {
+ if ((indexP - indexO) !== 0) {
+ var hexP = decimalToHexString(indexP);
+ var hexO = decimalToHexString(indexO);
+ throw new Test262Error('#' + hexO + '-' + hexP + ' ');
+ } else {
+ var hexP = decimalToHexString(indexP);
+ throw new Test262Error('#' + hexP + ' ');
+ }
+ throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.1_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.1_T1.js
new file mode 100644
index 0000000000..2185098a6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.1_T1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ unescapedURISet containing one instance of each character valid in
+ uriReserved
+esid: sec-encodeuri-uri
+description: Complex tests
+---*/
+
+var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","];
+for (var indexC = 0; indexC < uriReserved.length; indexC++) {
+ var str = uriReserved[indexC];
+ if (encodeURI(str) !== str) {
+ throw new Test262Error('#' + (indexC + 1) + ': unescapedURISet containing' + str);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T1.js
new file mode 100644
index 0000000000..f99bbad69b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ unescapedURISet containing one instance of each character valid in
+ uriUnescaped
+esid: sec-encodeuri-uri
+description: "Complex tests, uriUnescaped :: uriAlpha"
+---*/
+
+var uriAlpha = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
+for (var indexC = 0; indexC < uriAlpha.length; indexC++) {
+ var str = uriAlpha[indexC];
+ if (encodeURI(str) !== str) {
+ throw new Test262Error('#' + (indexC + 1) + ': unescapedURISet containing ' + str);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T2.js
new file mode 100644
index 0000000000..b7fd1668f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ unescapedURISet containing one instance of each character valid in
+ uriUnescaped
+esid: sec-encodeuri-uri
+description: "Complex tests, uriUnescaped :: DecimalDigit"
+---*/
+
+var DecimalDigit = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
+for (var indexC = 0; indexC < DecimalDigit.length; indexC++) {
+ var str = DecimalDigit[indexC];
+ if (encodeURI(str) !== str) {
+ throw new Test262Error('#' + (indexC + 1) + ': unescapedURISet containing' + str);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T3.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T3.js
new file mode 100644
index 0000000000..3fe7f39f51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.2_T3.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ unescapedURISet containing one instance of each character valid in
+ uriUnescaped
+esid: sec-encodeuri-uri
+description: "Complex tests, uriUnescaped :: uriMark"
+---*/
+
+var uriMark = ["-", "_", ".", "!", "~", "*", "'", "(", ")"];
+for (var indexC = 0; indexC < uriMark.length; indexC++) {
+ var str = uriMark[indexC];
+ if (encodeURI(str) !== str) {
+ throw new Test262Error('#' + (indexC + 1) + ': unescapedURISet containing' + str);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.3_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.3_T1.js
new file mode 100644
index 0000000000..efa80f8843
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A3.3_T1.js
@@ -0,0 +1,14 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: unescapedURISet containing "#"
+esid: sec-encodeuri-uri
+description: encodeURI("#") === "#"
+---*/
+
+if (encodeURI("#") !== "#") {
+ throw new Test262Error('#1: unescapedURISet containing "#"');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T1.js
new file mode 100644
index 0000000000..b17eed97a1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: URI tests
+esid: sec-encodeuri-uri
+description: Checking ENGLISH ALPHABET
+---*/
+
+//CHECK#1
+if (encodeURI("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") {
+ throw new Test262Error('#1: http://unipro.ru/0123456789');
+}
+
+//CHECK#2
+if (encodeURI("aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") !== "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") {
+ throw new Test262Error('#2: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ');
+}
+
+//CHECK#3
+if (encodeURI("aA_bB-cC.dD!eE~fF*gG'hH(iI)jJ;kK/lL?mM:nN@oO&pP=qQ+rR$sS,tT9uU8vV7wW6xX5yY4zZ") !== "aA_bB-cC.dD!eE~fF*gG'hH(iI)jJ;kK/lL?mM:nN@oO&pP=qQ+rR$sS,tT9uU8vV7wW6xX5yY4zZ") {
+ throw new Test262Error('#3: ');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T2.js
new file mode 100644
index 0000000000..35502558dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T2.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: URI tests
+esid: sec-encodeuri-uri
+description: Checking RUSSIAN ALPHABET
+---*/
+
+//CHECK#1
+if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод") !== "http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4") && (encodeURI("http://ru.wikipedia.org/wiki/Юникод") !== "http://ru.wikipedia.org/wiki/" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4".toLowerCase())) {
+ throw new Test262Error('#1: http://ru.wikipedia.org/wiki/Юникод');
+}
+
+//CHECK#2
+if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8") && (encodeURI("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "http://ru.wikipedia.org/wiki/" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8".toLowerCase())) {
+ throw new Test262Error('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки');
+}
+
+//CHECK#3
+if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Версии Юникода") !== "http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%D0%92%D0%B5%D1%80%D1%81%D0%B8%D0%B8%20%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%D0%B0") && ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Версии Юникода") !== "http://ru.wikipedia.org/wiki/" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%D0%92%D0%B5%D1%80%D1%81%D0%B8%D0%B8%20%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%D0%B0".toLowerCase()))) {
+ throw new Test262Error('#3: http://ru.wikipedia.org/wiki/Юникод#Версии Юникода');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T3.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T3.js
new file mode 100644
index 0000000000..fd02113531
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T3.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: URI tests
+esid: sec-encodeuri-uri
+description: Checking URL with Line Terminator
+---*/
+
+//CHECK#1
+if ((encodeURI("http://unipro.ru/\nabout") !== "http://unipro.ru/%0Aabout") && encodeURI("http://unipro.ru/\nabout") !== "http://unipro.ru/%0aabout") {
+ throw new Test262Error('#1: http://unipro.ru/\\nabout');
+}
+
+//CHECK#2
+if ((encodeURI("http://unipro.ru/\vabout") !== "http://unipro.ru/%0Babout") && encodeURI("http://unipro.ru/\vabout") !== "http://unipro.ru/%0babout") {
+ throw new Test262Error('#2: http://unipro.ru/\\vabout');
+}
+
+//CHECK#3
+if ((encodeURI("http://unipro.ru/\fabout") !== "http://unipro.ru/%0Cabout") && encodeURI("http://unipro.ru/\fabout") !== "http://unipro.ru/%0cabout") {
+ throw new Test262Error('#3: http://unipro.ru/\\fabout');
+}
+
+//CHECK#4
+if ((encodeURI("http://unipro.ru/\rabout") !== "http://unipro.ru/%0Dabout") && encodeURI("http://unipro.ru/\rabout") !== "http://unipro.ru/%0dabout") {
+ throw new Test262Error('#4: http://unipro.ru/\\rabout');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T4.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T4.js
new file mode 100644
index 0000000000..10bb7cf952
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A4_T4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: URI tests
+esid: sec-encodeuri-uri
+description: Test some url
+---*/
+
+//CHECK#1
+if (encodeURI("") !== "") {
+ throw new Test262Error('#1: ""');
+}
+
+//CHECK#2
+if (encodeURI("http://unipro.ru") !== "http://unipro.ru") {
+ throw new Test262Error('#2: http://unipro.ru');
+}
+
+//CHECK#3
+if (encodeURI("http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") !== "http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") {
+ throw new Test262Error('#3: http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork"');
+}
+
+//CHECK#4
+if (encodeURI("http://en.wikipedia.org/wiki/UTF-8#Description") !== "http://en.wikipedia.org/wiki/UTF-8#Description") {
+ throw new Test262Error('#4: http://en.wikipedia.org/wiki/UTF-8#Description');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.1.js
new file mode 100644
index 0000000000..0dd30cfb76
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.1.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The length property of encodeURI has the attribute DontEnum
+esid: sec-encodeuri-uri
+description: Checking use propertyIsEnumerable, for-in
+---*/
+
+//CHECK#1
+if (encodeURI.propertyIsEnumerable('length') !== false) {
+ throw new Test262Error('#1: encodeURI.propertyIsEnumerable(\'length\') === false. Actual: ' + (encodeURI.propertyIsEnumerable('length')));
+}
+
+//CHECK#2
+var result = true;
+for (var p in encodeURI) {
+ if (p === "length") {
+ result = false;
+ }
+}
+
+if (result !== true) {
+ throw new Test262Error('#2: result = true; for (p in encodeURI) { if (p === "length") result = false; } result === true;');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.2.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.2.js
new file mode 100644
index 0000000000..905b24bab8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.2.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The length property of encodeURI does not have the attribute DontDelete
+esid: sec-encodeuri-uri
+description: Checking use hasOwnProperty, delete
+---*/
+
+//CHECK#1
+if (encodeURI.hasOwnProperty('length') !== true) {
+ throw new Test262Error('#1: encodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (encodeURI.hasOwnProperty('length')));
+}
+
+delete encodeURI.length;
+
+//CHECK#2
+if (encodeURI.hasOwnProperty('length') !== false) {
+ throw new Test262Error('#2: delete encodeURI.length; encodeURI.hasOwnProperty(\'length\') === false. Actual: ' + (encodeURI.hasOwnProperty('length')));
+}
+
+//CHECK#3
+if (encodeURI.length === undefined) {
+ throw new Test262Error('#3: delete encodeURI.length; encodeURI.length !== undefined');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.3.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.3.js
new file mode 100644
index 0000000000..e1868dfde5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.3.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The length property of encodeURI has the attribute ReadOnly
+esid: sec-encodeuri-uri
+description: Checking if varying the length property fails
+includes: [propertyHelper.js]
+---*/
+
+//CHECK#1
+var x = encodeURI.length;
+verifyNotWritable(encodeURI, "length", null, Infinity);
+if (encodeURI.length !== x) {
+ throw new Test262Error('#1: x = encodeURI.length; encodeURI.length = Infinity; encodeURI.length === x. Actual: ' + (encodeURI.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.4.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.4.js
new file mode 100644
index 0000000000..a7d05545ec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.4.js
@@ -0,0 +1,15 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The length property of encodeURI is 1
+esid: sec-encodeuri-uri
+description: encodeURI.length === 1
+---*/
+
+//CHECK#1
+if (encodeURI.length !== 1) {
+ throw new Test262Error('#1: encodeURI.length === 1. Actual: ' + (encodeURI.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.5.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.5.js
new file mode 100644
index 0000000000..f57a1c22bd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.5.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The encodeURI property has the attribute DontEnum
+esid: sec-encodeuri-uri
+description: Checking use propertyIsEnumerable, for-in
+---*/
+
+//CHECK#1
+if (this.propertyIsEnumerable('encodeURI') !== false) {
+ throw new Test262Error('#1: this.propertyIsEnumerable(\'encodeURI\') === false. Actual: ' + (this.propertyIsEnumerable('encodeURI')));
+}
+
+//CHECK#2
+var result = true;
+for (var p in this) {
+ if (p === "encodeURI") {
+ result = false;
+ }
+}
+
+if (result !== true) {
+ throw new Test262Error('#2: result = true; for (p in this) { if (p === "encodeURI") result = false; } result === true;');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.6.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.6.js
new file mode 100644
index 0000000000..2338c80f91
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.6.js
@@ -0,0 +1,15 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The encodeURI property has not prototype property
+esid: sec-encodeuri-uri
+description: Checking encodeURI.prototype
+---*/
+
+//CHECK#1
+if (encodeURI.prototype !== undefined) {
+ throw new Test262Error('#1: encodeURI.prototype === undefined. Actual: ' + (encodeURI.prototype));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.7.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.7.js
new file mode 100644
index 0000000000..9d11096f99
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A5.7.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The encodeURI property can't be used as constructor
+esid: sec-encodeuri-uri
+description: >
+ If property does not implement the internal [[Construct]] method,
+ throw a TypeError exception
+---*/
+
+//CHECK#1
+
+try {
+ new encodeURI();
+ throw new Test262Error('#1.1: new encodeURI() throw TypeError. Actual: ' + (new encodeURI()));
+} catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1.2: new encodeURI() throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A6_T1.js b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A6_T1.js
new file mode 100644
index 0000000000..564ecf8c9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/S15.1.3.3_A6_T1.js
@@ -0,0 +1,129 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator use ToString
+esid: sec-encodeuri-uri
+description: If Type(value) is Object, evaluate ToPrimitive(value, String)
+---*/
+
+//CHECK#1
+var object = {
+ valueOf: function() {
+ return "^"
+ }
+};
+if (encodeURI(object) !== "%5Bobject%20Object%5D") {
+ throw new Test262Error('#1: var object = {valueOf: function() {return "^"}}; encodeURI(object) === %5Bobject%20Object%5D. Actual: ' + (encodeURI(object)));
+}
+
+//CHECK#2
+var object = {
+ valueOf: function() {
+ return ""
+ },
+ toString: function() {
+ return "^"
+ }
+};
+if (encodeURI(object) !== "%5E") {
+ throw new Test262Error('#2: var object = {valueOf: function() {return ""}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object)));
+}
+
+//CHECK#3
+var object = {
+ valueOf: function() {
+ return "^"
+ },
+ toString: function() {
+ return {}
+ }
+};
+if (encodeURI(object) !== "%5E") {
+ throw new Test262Error('#3: var object = {valueOf: function() {return "^"}, toString: function() {return {}}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object)));
+}
+
+//CHECK#4
+try {
+ var object = {
+ valueOf: function() {
+ throw "error"
+ },
+ toString: function() {
+ return "^"
+ }
+ };
+ if (encodeURI(object) !== "%5E") {
+ throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object)));
+ }
+}
+catch (e) {
+ if (e === "error") {
+ throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) not throw "error"');
+ } else {
+ throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) not throw Error. Actual: ' + (e));
+ }
+}
+
+//CHECK#5
+var object = {
+ toString: function() {
+ return "^"
+ }
+};
+if (encodeURI(object) !== "%5E") {
+ throw new Test262Error('#5: var object = {toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object)));
+}
+
+//CHECK#6
+var object = {
+ valueOf: function() {
+ return {}
+ },
+ toString: function() {
+ return "^"
+ }
+}
+if (encodeURI(object) !== "%5E") {
+ throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object)));
+}
+
+//CHECK#7
+try {
+ var object = {
+ valueOf: function() {
+ return "^"
+ },
+ toString: function() {
+ throw "error"
+ }
+ };
+ encodeURI(object);
+ throw new Test262Error('#7.1: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURI(object) throw "error". Actual: ' + (encodeURI(object)));
+}
+catch (e) {
+ if (e !== "error") {
+ throw new Test262Error('#7.2: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURI(object) throw "error". Actual: ' + (e));
+ }
+}
+
+//CHECK#8
+try {
+ var object = {
+ valueOf: function() {
+ return {}
+ },
+ toString: function() {
+ return {}
+ }
+ };
+ encodeURI(object);
+ throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURI(object) throw TypeError. Actual: ' + (encodeURI(object)));
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURI(object) throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/browser.js b/js/src/tests/test262/built-ins/encodeURI/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/browser.js
diff --git a/js/src/tests/test262/built-ins/encodeURI/name.js b/js/src/tests/test262/built-ins/encodeURI/name.js
new file mode 100644
index 0000000000..efb7966e6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-encodeuri-uri
+description: >
+ encodeURI.name is "encodeURI".
+info: |
+ encodeURI (uri)
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(encodeURI.name, "encodeURI");
+
+verifyNotEnumerable(encodeURI, "name");
+verifyNotWritable(encodeURI, "name");
+verifyConfigurable(encodeURI, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/not-a-constructor.js b/js/src/tests/test262/built-ins/encodeURI/not-a-constructor.js
new file mode 100644
index 0000000000..fa9ab49cf7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ encodeURI does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(encodeURI), false, 'isConstructor(encodeURI) must return false');
+
+assert.throws(TypeError, () => {
+ new encodeURI('');
+}, '`new encodeURI(\'\')` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/prop-desc.js b/js/src/tests/test262/built-ins/encodeURI/prop-desc.js
new file mode 100644
index 0000000000..83d15390c8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/prop-desc.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2019 Bocoup. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-encodeuri-uri
+description: Property descriptor for encodeURI
+info: |
+ Every other data property described in clauses 18 through 26 and in Annex B.2
+ has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(this, "encodeURI");
+verifyWritable(this, "encodeURI");
+verifyConfigurable(this, "encodeURI");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/encodeURI/shell.js b/js/src/tests/test262/built-ins/encodeURI/shell.js
new file mode 100644
index 0000000000..a9bb766df3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/encodeURI/shell.js
@@ -0,0 +1,52 @@
+// GENERATED, DO NOT EDIT
+// file: decimalToHexString.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Collection of functions used to assert the correctness of various encoding operations.
+defines: [decimalToHexString, decimalToPercentHexString]
+---*/
+
+function decimalToHexString(n) {
+ var hex = "0123456789ABCDEF";
+ n >>>= 0;
+ var s = "";
+ while (n) {
+ s = hex[n & 0xf] + s;
+ n >>>= 4;
+ }
+ while (s.length < 4) {
+ s = "0" + s;
+ }
+ return s;
+}
+
+function decimalToPercentHexString(n) {
+ var hex = "0123456789ABCDEF";
+ return "%" + hex[(n >> 4) & 0xf] + hex[n & 0xf];
+}
+
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}