diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/decodeURI | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/decodeURI')
57 files changed, 2768 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.10_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.10_T1.js new file mode 100644 index 0000000000..2da74c6f25 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.10_T1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 110xxxxx (n = 2) and string.charAt(k + 4) and + string.charAt(k + 5) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%C0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 110xxxxx (n = 2) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T1.js new file mode 100644 index 0000000000..6015feb776 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and + string.charAt(k + 5)) or (string.charAt(k + 7) and + string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests, string.charAt(k + 4) and string.charAt(k + 5) do + not represent hexadecimal digits +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%E0%" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T2.js new file mode 100644 index 0000000000..711ff69a18 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.11_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and + string.charAt(k + 5)) or (string.charAt(k + 7) and + string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests, string.charAt(k + 7) and string.charAt(k + 8) do + not represent hexadecimal digits +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%E0" + "%A0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 1110xxxx (n = 3) and (string.charAt(k + 7) and string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T1.js new file mode 100644 index 0000000000..1dd43b0427 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + string.charAt(k + 5)) or (string.charAt(k + 7) and + string.charAt(k + 8)) or (string.charAt(k + 10) and + string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests, string.charAt(k + 4) and string.charAt(k + 5) do + not represent hexadecimal digits +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0%" + String.fromCharCode(indexJ, indexJ) + "%A0%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T2.js new file mode 100644 index 0000000000..9096f848b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + string.charAt(k + 5)) or (string.charAt(k + 7) and + string.charAt(k + 8)) or (string.charAt(k + 10) and + string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests, string.charAt(k + 7) and string.charAt(k + 7) do + not represent hexadecimal digits +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0" + "%A0%" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 7) and string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T3.js new file mode 100644 index 0000000000..7b6fc99aba --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.12_T3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + string.charAt(k + 5)) or (string.charAt(k + 7) and + string.charAt(k + 8)) or (string.charAt(k + 10) and + string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests, string.charAt(k + 10) and string.charAt(k + 11) do + not represent hexadecimal digits +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0" + "%A0%A0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 10) and string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_T1.js new file mode 100644 index 0000000000..7e0080312e --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_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 B = 110xxxxx (n = 2) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xC0 - 0xDF], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_T2.js new file mode 100644 index 0000000000..407e55d8e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.13_T2.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 B = 110xxxxx (n = 2) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xC0 - 0xDF], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T1.js new file mode 100644 index 0000000000..c9843ce138 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_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 B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T2.js new file mode 100644 index 0000000000..e96b692954 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T2.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 B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0" + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T3.js new file mode 100644 index 0000000000..4ea20affc6 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T3.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 B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T4.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T4.js new file mode 100644 index 0000000000..8888f53715 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.14_T4.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 B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0" + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T1.js new file mode 100644 index 0000000000..67d7791306 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC + "%A0%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T2.js new file mode 100644 index 0000000000..53f9008df4 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T2.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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0" + hexC + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T3.js new file mode 100644 index 0000000000..1032180d28 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T3.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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0%A0" + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T4.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T4.js new file mode 100644 index 0000000000..6b0f0c6fa7 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T4.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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + hexC + "%A0%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T5.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T5.js new file mode 100644 index 0000000000..3cc304ec8a --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T5.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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0" + hexC + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T6.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T6.js new file mode 100644 index 0000000000..73ee0544c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.15_T6.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 B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), + throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToPercentHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToPercentHexString(indexC); + try { + decodeURI(hexB + "%A0%A0" + hexC); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.1_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.1_T1.js new file mode 100644 index 0000000000..5b03927f36 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.1_T1.js @@ -0,0 +1,56 @@ +// 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) equal "%" and k + 2 >= string.length, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests +---*/ + +var result = true; + +//CHECK#1 +try { + decodeURI("%"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#2 +try { + decodeURI("%A"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#3 +try { + decodeURI("%1"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#4 +try { + decodeURI("% "); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T1.js new file mode 100644 index 0000000000..f23ec6323a --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = string.charAt(k+1) + string.charAt(k+2) do not represent + hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%" + String.fromCharCode(indexJ) + "1"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k+1) does not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T2.js new file mode 100644 index 0000000000..38218a2c8b --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.2_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = string.charAt(k+1) + string.charAt(k+2) do not represent + hexadecimal digits, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests +---*/ + +//CHECK +var result = true; +var interval = [ + [0x00, 0x2F], + [0x3A, 0x40], + [0x47, 0x60], + [0x67, 0xFFFF] +]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%" + "1" + String.fromCharCode(indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k+2) does not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T1.js new file mode 100644 index 0000000000..d1e0709121 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T1.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B = 10xxxxxx or B = 11111xxx, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = 10xxxxxx -> B in [0x80 - 0xBF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0x80; index <= 0xBF; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T2.js new file mode 100644 index 0000000000..1e66b7e5ca --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.3_T2.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B = 10xxxxxx or B = 11111xxx, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF8; index <= 0xFF; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.4_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.4_T1.js new file mode 100644 index 0000000000..6812c29bdc --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.4_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B = 110xxxxx (n = 2) and (k + 2) + 3 >= length, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xC0 - 0xDF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xC0; index <= 0xDF; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 3; len++) { + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.5_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.5_T1.js new file mode 100644 index 0000000000..a9a2e66610 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.5_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B = 1110xxxx (n = 3) and (k + 2) + 6 >= length, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xE0 - 0xEF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 6; len++) { + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.6_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.6_T1.js new file mode 100644 index 0000000000..7483b68439 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.6_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B = 11110xxx (n = 4) and (k + 2) + 9 >= length, throw URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xF0 - 0xF7] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 9; len++) { + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.7_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.7_T1.js new file mode 100644 index 0000000000..4ef20d5835 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.7_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 110xxxxx (n = 2) and string.charAt(k + 3) not equal "%", throw + URIError +esid: sec-decodeuri-encodeduri +description: Complex tests. B = [0xC0 - 0xDF] +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xC0; index <= 0xDF; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "111"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T1.js new file mode 100644 index 0000000000..758fc35df3 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T1.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 1110xxxx (n = 3) and string.charAt(k + 3), + string.charAt(k + 6) not equal "%", throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 3) not equal "%" +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "111%A0"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T2.js new file mode 100644 index 0000000000..3304c87244 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.8_T2.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 1110xxxx (n = 3) and string.charAt(k + 3), + string.charAt(k + 6) not equal "%", throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 6) not equal "%" +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "%A0111"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T1.js new file mode 100644 index 0000000000..3c4b59ac55 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T1.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and string.charAt(k + 3), + string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 3) not equal "%" +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "111%A0%A0"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T2.js new file mode 100644 index 0000000000..02e68cf897 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T2.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and string.charAt(k + 3), + string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 6) not equal "%" +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "%A0111%A0"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T3.js new file mode 100644 index 0000000000..d4c3cf6256 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A1.9_T3.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B = 11110xxx (n = 4) and string.charAt(k + 3), + string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError +esid: sec-decodeuri-encodeduri +description: > + Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 9) not equal "%" +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToPercentHexString(index); + try { + decodeURI(hex + "%A0%A0111"); + } 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); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.1_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.1_T1.js new file mode 100644 index 0000000000..1c4a83ced0 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.1_T1.js @@ -0,0 +1,35 @@ +// 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) not equal "%", return this char +esid: sec-decodeuri-encodeduri +description: Complex tests +includes: [decimalToHexString.js] +---*/ + +//CHECK +var errorCount = 0; +var count = 0; +for (var indexI = 0; indexI <= 65535; indexI++) { + if (indexI !== 0x25) { + var hex = decimalToHexString(indexI); + try { + var str = String.fromCharCode(indexI); + if (decodeURI(str) !== str) { + $ERROR('#' + hex + ' '); + errorCount++; + } + } catch (e) { + $ERROR('#' + hex + ' '); + errorCount++; + } + count++; + } +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.2_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.2_T1.js new file mode 100644 index 0000000000..911cfbc683 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.2_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If B1 = 0xxxxxxxx ([0x00 - 0x7F]), without [uriReserved, #], return B1 +esid: sec-decodeuri-encodeduri +description: Complex tests, use RFC 3629 +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","]; +l: + for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) { + count++; + var hexB1 = decimalToPercentHexString(indexB1); + var index = indexB1; + var hex = String.fromCharCode(index); + for (var indexC = 0; indexC < uriReserved.length; indexC++) { + if (hex === uriReserved[indexC]) continue l; + } + if (hex === "#") continue; + if (decodeURI(hexB1) === hex) continue; + + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.3_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.3_T1.js new file mode 100644 index 0000000000..79031115ca --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.3_T1.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B1 = 110xxxxx ([0xC0 - 0xDF]), B2 = 10xxxxxx ([0x80 - 0xBF), without + B1 = [0xC0, 0xC1], return UTF8(B1, B2) +esid: sec-decodeuri-encodeduri +description: Complex tests, use RFC 3629 +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xC2; indexB1 <= 0xDF; indexB1++) { + var hexB1 = decimalToPercentHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + count++; + var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2); + var index = (indexB1 & 0x1F) * 0x40 + (indexB2 & 0x3F); + if (decodeURI(hexB1_B2) === String.fromCharCode(index)) continue; + + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.4_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.4_T1.js new file mode 100644 index 0000000000..9115d9ac04 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.4_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 B1 = 1110xxxx ([0xE0 - 0xEF]), B2, B3 = 10xxxxxxx ([0x80 - 0xBF]), + without [B1, B2] = [0xE0, 0x80 - 0x9F], [0xED, 0xA0 - 0xBF] (0xD800 - + 0xDFFF), return UTF8(B1, B2, B3) +esid: sec-decodeuri-encodeduri +description: Complex tests, use RFC 3629 +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xE0; indexB1 <= 0xEF; indexB1++) { + var hexB1 = decimalToPercentHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xE0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xED) && (0xA0 <= indexB2)) continue; + var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2); + for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + count++; + var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3); + var index = (indexB1 & 0x0F) * 0x1000 + (indexB2 & 0x3F) * 0x40 + (indexB3 & 0x3F); + if (decodeURI(hexB1_B2_B3) === String.fromCharCode(index)) continue; + + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.5_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.5_T1.js new file mode 100644 index 0000000000..020052147b --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A2.5_T1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If B1 = 11110xxx ([0xF0 - 0x0F4]), B2, B3, B4 = 10xxxxxxx ([0x80 - + 0xBF]), without [B1, B2] = [0xF0, 0x80 - 0x9F], [0xF4, 0x90 - 0xBF], + return UTF8(B1, B2, B3, B4) +esid: sec-decodeuri-encodeduri +description: Complex tests, use RFC 3629 +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xF0; indexB1 <= 0xF4; indexB1++) { + var hexB1 = decimalToPercentHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xF0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xF4) && (indexB2 >= 0x90)) continue; + var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2); + for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3); + for (var indexB4 = 0x80; indexB4 <= 0xBF; indexB4++) { + var hexB1_B2_B3_B4 = hexB1_B2_B3 + decimalToPercentHexString(indexB4); + count++; + var index = (indexB1 & 0x07) * 0x40000 + (indexB2 & 0x3F) * 0x1000 + (indexB3 & 0x3F) * 0x40 + (indexB4 & 0x3F); + var L = ((index - 0x10000) & 0x03FF) + 0xDC00; + var H = (((index - 0x10000) >> 10) & 0x03FF) + 0xD800; + if (decodeURI(hexB1_B2_B3_B4) === String.fromCharCode(H, L)) continue; + + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + } + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T1.js new file mode 100644 index 0000000000..d35e8d237b --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T1.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Let reservedURISet be a string containing one instance of each character valid + in uriReserved plus "#" +esid: sec-decodeuri-encodeduri +description: Checking all character in reservedURISet. HexDigit in [0..9, A..F] +---*/ + +//CHECK#1 +if (decodeURI("%3B") !== "%3B") { + $ERROR('#1: decodeURI("%3B") equal "%3B", not ";"'); +} + +//CHECK#2 +if (decodeURI("%2F") !== "%2F") { + $ERROR('#2: decodeURI("%2F") equal "%2F", not "/"'); +} + +//CHECK#3 +if (decodeURI("%3F") !== "%3F") { + $ERROR('#3: decodeURI("%3F") equal "%3F", not "?"'); +} + +//CHECK#4 +if (decodeURI("%3A") !== "%3A") { + $ERROR('#4: decodeURI("%3A") equal "%3A", not ":"'); +} + +//CHECK#5 +if (decodeURI("%40") !== "%40") { + $ERROR('#5: decodeURI("%40") equal "%40", not "@"'); +} + +//CHECK#6 +if (decodeURI("%26") !== "%26") { + $ERROR('#6: decodeURI("%26") equal "%26", not "&"'); +} + +//CHECK#7 +if (decodeURI("%3D") !== "%3D") { + $ERROR('#7.1: decodeURI("%3D") equal "%3D", not "="'); +} + +//CHECK#8 +if (decodeURI("%2B") !== "%2B") { + $ERROR('#8.1: decodeURI("%2B") equal "%2B", not "+"'); +} + +//CHECK#9 +if (decodeURI("%24") !== "%24") { + $ERROR('#9: decodeURI("%24") equal "%24", not "$"'); +} + +//CHECK#10 +if (decodeURI("%2C") !== "%2C") { + $ERROR('#10: decodeURI("%2C") equal "%2C", not ","'); +} + +//CHECK#11 +if (decodeURI("%23") !== "%23") { + $ERROR('#11: decodeURI("%23") equal "%23", not "#"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T2.js new file mode 100644 index 0000000000..a0a99c0053 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T2.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Let reservedURISet be a string containing one instance of each character valid + in uriReserved plus "#" +esid: sec-decodeuri-encodeduri +description: Checking all character in reservedURISet. HexDigit in [0..9, a..f] +---*/ + +//CHECK#1 +if (decodeURI("%3b") !== "%3b") { + $ERROR('#1: decodeURI("%3b") equal "%3b", not ";" or "%3B"'); +} + +//CHECK#2 +if (decodeURI("%2f") !== "%2f") { + $ERROR('#2: decodeURI("%2f") equal "%2f", not "/" or "%2F"'); +} + +//CHECK#3 +if (decodeURI("%3f") !== "%3f") { + $ERROR('#3: decodeURI("%3f") equal "%3f", not "?" or "%3F"'); +} + +//CHECK#4 +if (decodeURI("%3a") !== "%3a") { + $ERROR('#4: decodeURI("%3a") equal "%3a", not ":" or "%3A"'); +} + +//CHECK#5 +if (decodeURI("%40") !== "%40") { + $ERROR('#5: decodeURI("%40") equal "%40", not "@"'); +} + +//CHECK#6 +if (decodeURI("%26") !== "%26") { + $ERROR('#6: decodeURI("%26") equal "%26", not "&"'); +} + +//CHECK#7 +if (decodeURI("%3d") !== "%3d") { + $ERROR('#7.1: decodeURI("%3d") equal "%3d", not "=" or "%3D"'); +} + +//CHECK#8 +if (decodeURI("%2b") !== "%2b") { + $ERROR('#8.1: decodeURI("%2b") equal "%2b", not "+" or "%2B"'); +} + +//CHECK#9 +if (decodeURI("%24") !== "%24") { + $ERROR('#9: decodeURI("%24") equal "%24", not "$"'); +} + +//CHECK#10 +if (decodeURI("%2c") !== "%2c") { + $ERROR('#10: decodeURI("%2c") equal "%2c", not "," or "%2C"'); +} + +//CHECK#11 +if (decodeURI("%23") !== "%23") { + $ERROR('#11: decodeURI("%23") equal "%23", not "#"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T3.js new file mode 100644 index 0000000000..b0055aa2ed --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Let reservedURISet be a string containing one instance of each character valid + in uriReserved plus "#" +esid: sec-decodeuri-encodeduri +description: Complex test +---*/ + +//CHECK#1 +if (decodeURI("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") !== "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") { + $ERROR('#1: decodeURI("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") equal "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23", not ";/?:@&=+$,#"'); +} + +//CHECK#2 +if (decodeURI("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") !== "%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") { + $ERROR('#2: decodeURI("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") equal "%3b%2f%3f%3a%40%26%3d%2b%24%2c%23", not ";/?:@&=+$,#" or "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T1.js new file mode 100644 index 0000000000..b840f2331e --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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-decodeuri-encodeduri +description: Checking ENGLISH ALPHABET +---*/ + +//CHECK#1 +if (decodeURI("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") { + $ERROR('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (decodeURI("%41%42%43%44%45%46%47%48%49%4A%4B%4C%4D%4E%4F%50%51%52%53%54%55%56%57%58%59%5A") !== "ABCDEFGHIJKLMNOPQRSTUVWXYZ") { + $ERROR('#2: ABCDEFGHIJKLMNOPQRSTUVWXYZ'); +} + +//CHECK#3 +if (decodeURI("%61%62%63%64%65%66%67%68%69%6A%6B%6C%6D%6E%6F%70%71%72%73%74%75%76%77%78%79%7A") !== "abcdefghijklmnopqrstuvwxyz") { + $ERROR('#3: abcdefghijklmnopqrstuvwxyz'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T2.js new file mode 100644 index 0000000000..c20506e2ef --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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-decodeuri-encodeduri +description: Checking RUSSIAN ALPHABET +---*/ + +//CHECK#1 +if (decodeURI("http://ru.wikipedia.org/wiki/%d0%ae%D0%bd%D0%B8%D0%BA%D0%BE%D0%B4") !== "http://ru.wikipedia.org/wiki/Юникод") { + $ERROR('#1: http://ru.wikipedia.org/wiki/Юникод'); +} + +//CHECK#2 +if (decodeURI("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") !== "http://ru.wikipedia.org/wiki/Юникод#Ссылки") { + $ERROR('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки'); +} + +//CHECK#3 +if (decodeURI("http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%23%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") !== "http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода") { + $ERROR('#3: http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T3.js new file mode 100644 index 0000000000..e90adfac7e --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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-decodeuri-encodeduri +description: Checking URL with Line Terminator +---*/ + +//CHECK#1 +if (decodeURI("http://unipro.ru/%0Aabout") !== "http://unipro.ru/\nabout") { + $ERROR('#1: http://unipro.ru/%A0about'); +} + +//CHECK#2 +if (decodeURI("http://unipro.ru/%0Babout") !== "http://unipro.ru/\vabout") { + $ERROR('#2: http://unipro.ru/%0Babout'); +} + +//CHECK#3 +if (decodeURI("http://unipro.ru/%0Cabout") !== "http://unipro.ru/\fabout") { + $ERROR('#3: http://unipro.ru/%0Cabout'); +} + +//CHECK#4 +if (decodeURI("http://unipro.ru/%0Dabout") !== "http://unipro.ru/\rabout") { + $ERROR('#4: http://unipro.ru/%0Dabout'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T4.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A4_T4.js new file mode 100644 index 0000000000..e940947080 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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-decodeuri-encodeduri +description: Test some url +---*/ + +//CHECK#1 +if (decodeURI("") !== "") { + $ERROR('#1: ""'); +} + +//CHECK#2 +if (decodeURI("http:%2f%2Funipro.ru") !== "http:%2f%2Funipro.ru") { + $ERROR('#2: http:%2f%2Funipro.ru'); +} + +//CHECK#3 +if (decodeURI("http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") !== "http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") { + $ERROR('#3: http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork"'); +} + +//CHECK%234 +if (decodeURI("http://en.wikipedia.org/wiki/UTF-8%23Description") !== "http://en.wikipedia.org/wiki/UTF-8%23Description") { + $ERROR('%234: http://en.wikipedia.org/wiki/UTF-8%23Description'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.1.js new file mode 100644 index 0000000000..3776988139 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI has the attribute DontEnum +esid: sec-decodeuri-encodeduri +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (decodeURI.propertyIsEnumerable('length') !== false) { + $ERROR('#1: decodeURI.propertyIsEnumerable(\'length\') === false. Actual: ' + (decodeURI.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (var p in decodeURI) { + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in decodeURI) { if (p === "length") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.2.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.2.js new file mode 100644 index 0000000000..b7196ff7c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI does not have the attribute DontDelete +esid: sec-decodeuri-encodeduri +description: Checking use hasOwnProperty, delete +---*/ + +//CHECK#1 +if (decodeURI.hasOwnProperty('length') !== true) { + $ERROR('#1: decodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURI.hasOwnProperty('length'))); +} + +delete decodeURI.length; + +//CHECK#2 +if (decodeURI.hasOwnProperty('length') !== false) { + $ERROR('#2: delete decodeURI.length; decodeURI.hasOwnProperty(\'length\') === false. Actual: ' + (decodeURI.hasOwnProperty('length'))); +} + +//CHECK#3 +if (decodeURI.length === undefined) { + $ERROR('#3: delete decodeURI.length; decodeURI.length !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.3.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.3.js new file mode 100644 index 0000000000..c65eea43ab --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI has the attribute ReadOnly +esid: sec-decodeuri-encodeduri +description: Checking if varying the length property fails +includes: [propertyHelper.js] +---*/ + +//CHECK#1 +var x = decodeURI.length; +verifyNotWritable(decodeURI, "length", null, Infinity); +if (decodeURI.length !== x) { + $ERROR('#1: x = decodeURI.length; decodeURI.length = Infinity; decodeURI.length === x. Actual: ' + (decodeURI.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.4.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.4.js new file mode 100644 index 0000000000..1b760bac70 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI is 1 +esid: sec-decodeuri-encodeduri +description: decodeURI.length === 1 +---*/ + +//CHECK#1 +if (decodeURI.length !== 1) { + $ERROR('#1: decodeURI.length === 1. Actual: ' + (decodeURI.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.5.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.5.js new file mode 100644 index 0000000000..a8052dbfa6 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI property has the attribute DontEnum +esid: sec-decodeuri-encodeduri +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (this.propertyIsEnumerable('decodeURI') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'decodeURI\') === false. Actual: ' + (this.propertyIsEnumerable('decodeURI'))); +} + +//CHECK#2 +var result = true; +for (var p in this) { + if (p === "decodeURI") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "decodeURI") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.6.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.6.js new file mode 100644 index 0000000000..b250b86b34 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI property has not prototype property +esid: sec-decodeuri-encodeduri +description: Checking decodeURI.prototype +---*/ + +//CHECK#1 +if (decodeURI.prototype !== undefined) { + $ERROR('#1: decodeURI.prototype === undefined. Actual: ' + (decodeURI.prototype)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.7.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A5.7.js new file mode 100644 index 0000000000..17a264bf40 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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 decodeURI property can't be used as constructor +esid: sec-decodeuri-encodeduri +description: > + If property does not implement the internal [[Construct]] method, + throw a TypeError exception +---*/ + +//CHECK#1 + +try { + new decodeURI(); + $ERROR('#1.1: new decodeURI() throw TypeError. Actual: ' + (new decodeURI())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new decodeURI() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A6_T1.js b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_A6_T1.js new file mode 100644 index 0000000000..d74cbf6dcd --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/S15.1.3.1_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-decodeuri-encodeduri +description: If Type(value) is Object, evaluate ToPrimitive(value, String) +---*/ + +//CHECK#1 +var object = { + valueOf: function() { + return "%5E" + } +}; +if (decodeURI(object) !== "[object Object]") { + $ERROR('#1: var object = {valueOf: function() {return "%5E"}}; decodeURI(object) === [object Object]. Actual: ' + (decodeURI(object))); +} + +//CHECK#2 +var object = { + valueOf: function() { + return "" + }, + toString: function() { + return "%5E" + } +}; +if (decodeURI(object) !== "^") { + $ERROR('#2: var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#3 +var object = { + valueOf: function() { + return "%5E" + }, + toString: function() { + return {} + } +}; +if (decodeURI(object) !== "^") { + $ERROR('#3: var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#4 +try { + var object = { + valueOf: function() { + throw "error" + }, + toString: function() { + return "%5E" + } + }; + if (decodeURI(object) !== "^") { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = { + toString: function() { + return "%5E" + } +}; +if (decodeURI(object) !== "^") { + $ERROR('#5: var object = {toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#6 +var object = { + valueOf: function() { + return {} + }, + toString: function() { + return "%5E" + } +} +if (decodeURI(object) !== "^") { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#7 +try { + var object = { + valueOf: function() { + return "%5E" + }, + toString: function() { + throw "error" + } + }; + decodeURI(object); + $ERROR('#7.1: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURI(object) throw "error". Actual: ' + (decodeURI(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURI(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = { + valueOf: function() { + return {} + }, + toString: function() { + return {} + } + }; + decodeURI(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURI(object) throw TypeError. Actual: ' + (decodeURI(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURI(object) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/browser.js b/js/src/tests/test262/built-ins/decodeURI/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/browser.js diff --git a/js/src/tests/test262/built-ins/decodeURI/name.js b/js/src/tests/test262/built-ins/decodeURI/name.js new file mode 100644 index 0000000000..49e92af77d --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/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-decodeuri-encodeduri +description: > + decodeURI.name is "decodeURI". +info: | + decodeURI (encodedURI) + + 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(decodeURI.name, "decodeURI"); + +verifyNotEnumerable(decodeURI, "name"); +verifyNotWritable(decodeURI, "name"); +verifyConfigurable(decodeURI, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/not-a-constructor.js b/js/src/tests/test262/built-ins/decodeURI/not-a-constructor.js new file mode 100644 index 0000000000..00a1e05e4c --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/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: > + decodeURI 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(decodeURI), false, 'isConstructor(decodeURI) must return false'); + +assert.throws(TypeError, () => { + new decodeURI(''); +}, '`new decodeURI(\'\')` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/prop-desc.js b/js/src/tests/test262/built-ins/decodeURI/prop-desc.js new file mode 100644 index 0000000000..b854ba429f --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2019 Bocoup. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-decodeuri-encodeduri +description: > + Property descriptor for decodeURI +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, "decodeURI"); +verifyWritable(this, "decodeURI"); +verifyConfigurable(this, "decodeURI"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURI/shell.js b/js/src/tests/test262/built-ins/decodeURI/shell.js new file mode 100644 index 0000000000..f1fef84474 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURI/shell.js @@ -0,0 +1,47 @@ +// 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] +---*/ + +function isConstructor(f) { + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} |