diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/decodeURIComponent | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
57 files changed, 2756 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.10_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.10_T1.js new file mode 100644 index 0000000000..9bb4b4fa17 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%C0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#1: If B = 110xxxxx (n = 2) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.11_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.11_T1.js new file mode 100644 index 0000000000..7d41ee6a78 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%E0%" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.11_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.11_T2.js new file mode 100644 index 0000000000..d999323968 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%E0" + "%A0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.12_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.12_T1.js new file mode 100644 index 0000000000..f5967a28a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%F0%" + String.fromCharCode(indexJ, indexJ) + "%A0%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.12_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.12_T2.js new file mode 100644 index 0000000000..91ae97b4da --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%F0" + "%A0%" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.12_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.12_T3.js new file mode 100644 index 0000000000..272c2727cc --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%F0" + "%A0%A0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.13_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.13_T1.js new file mode 100644 index 0000000000..acc9c423d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.13_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.13_T2.js new file mode 100644 index 0000000000..35d599c50f --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.14_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.14_T1.js new file mode 100644 index 0000000000..c0ed17de45 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.14_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.14_T2.js new file mode 100644 index 0000000000..49e3481d35 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.14_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.14_T3.js new file mode 100644 index 0000000000..070c180b08 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.14_T4.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.14_T4.js new file mode 100644 index 0000000000..6a5c7b097a --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T1.js new file mode 100644 index 0000000000..26da1c4afe --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T2.js new file mode 100644 index 0000000000..d02b90afa3 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T3.js new file mode 100644 index 0000000000..92e120eb79 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T4.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T4.js new file mode 100644 index 0000000000..31510f3166 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T5.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T5.js new file mode 100644 index 0000000000..fab331fad7 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.15_T6.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.15_T6.js new file mode 100644 index 0000000000..355e9bef08 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + 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/decodeURIComponent/S15.1.3.2_A1.1_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.1_T1.js new file mode 100644 index 0000000000..42413e5c3a --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: Complex tests +---*/ + +var result = true; + +//CHECK#1 +try { + decodeURIComponent("%"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#2 +try { + decodeURIComponent("%A"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#3 +try { + decodeURIComponent("%1"); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#4 +try { + decodeURIComponent("% "); + result = false; +} catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.2_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.2_T1.js new file mode 100644 index 0000000000..b10a7dfe73 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%" + String.fromCharCode(indexJ) + "1"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.2_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.2_T2.js new file mode 100644 index 0000000000..4e10d98a3c --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent("%" + "1" + String.fromCharCode(indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + throw new Test262Error('#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/decodeURIComponent/S15.1.3.2_A1.3_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.3_T1.js new file mode 100644 index 0000000000..b648e4f585 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.3_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.3_T2.js new file mode 100644 index 0000000000..33cd007f57 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.4_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.4_T1.js new file mode 100644 index 0000000000..580cb20c14 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.5_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.5_T1.js new file mode 100644 index 0000000000..95cd9afcdf --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.6_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.6_T1.js new file mode 100644 index 0000000000..0734b6e3be --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.7_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.7_T1.js new file mode 100644 index 0000000000..ba1b915b96 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.8_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.8_T1.js new file mode 100644 index 0000000000..5c215142df --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.8_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.8_T2.js new file mode 100644 index 0000000000..4841208b98 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.9_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.9_T1.js new file mode 100644 index 0000000000..23dc33e935 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.9_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.9_T2.js new file mode 100644 index 0000000000..bc3f6d0f6b --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A1.9_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A1.9_T3.js new file mode 100644 index 0000000000..4b41bdd644 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 { + decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A2.1_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.1_T1.js new file mode 100644 index 0000000000..203a206bdc --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.1_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: If string.charAt(k) not equal "%", return this char +esid: sec-decodeuricomponent-encodeduricomponent +description: Complex tests +includes: [decimalToHexString.js] +---*/ + +for (var indexI = 0; indexI <= 65535; indexI++) { + if (indexI !== 0x25) { + try { + var str = String.fromCharCode(indexI); + var differs = decodeURIComponent(str) !== str; + } catch (e) { + throw new Test262Error('#' + decimalToHexString(indexI) + ' throws'); + } + if (differs) { + throw new Test262Error('#' + decimalToHexString(indexI) + ' differs'); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.2_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.2_T1.js new file mode 100644 index 0000000000..017be33840 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.2_T1.js @@ -0,0 +1,54 @@ +// 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]), return B1 +esid: sec-decodeuricomponent-encodeduricomponent +description: Complex tests, use RFC 3629 +includes: [decimalToHexString.js] +---*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) { + count++; + var hexB1 = decimalToPercentHexString(indexB1); + var index = indexB1; + var hex = String.fromCharCode(index); + if (decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A2.3_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.3_T1.js new file mode 100644 index 0000000000..90f461fb2c --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 (decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A2.4_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.4_T1.js new file mode 100644 index 0000000000..7258068d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 (decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A2.5_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1.js new file mode 100644 index 0000000000..692215dbed --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +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 (decodeURIComponent(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); + 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/decodeURIComponent/S15.1.3.2_A3_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_T1.js new file mode 100644 index 0000000000..5ec1775aa9 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 reservedURIComponentSet be the empty string +esid: sec-decodeuricomponent-encodeduricomponent +description: > + uriReserved and "#" not in reservedURIComponentSet. HexDigit in + [0..9, A..F] +---*/ + +//CHECK#1 +if (decodeURIComponent("%3B") !== ";") { + throw new Test262Error('#1: decodeURIComponent("%3B") equal ";", not "%3B"'); +} + +//CHECK#2 +if (decodeURIComponent("%2F") !== "/") { + throw new Test262Error('#2: decodeURIComponent("%2F") equal "/", not "%2F"'); +} + +//CHECK#3 +if (decodeURIComponent("%3F") !== "?") { + throw new Test262Error('#3: decodeURIComponent("%3F") equal "?", not "%3F"'); +} + +//CHECK#4 +if (decodeURIComponent("%3A") !== ":") { + throw new Test262Error('#4: decodeURIComponent("%3A") equal ":", not "%3A"'); +} + +//CHECK#5 +if (decodeURIComponent("%40") !== "@") { + throw new Test262Error('#5: decodeURIComponent("%40") equal "@", not "%40"'); +} + +//CHECK#6 +if (decodeURIComponent("%26") !== "&") { + throw new Test262Error('#6: decodeURIComponent("%26") equal "&", not "%26"'); +} + +//CHECK#7 +if (decodeURIComponent("%3D") !== "=") { + throw new Test262Error('#7.1: decodeURIComponent("%3D") equal "=", not "%3D"'); +} + +//CHECK#8 +if (decodeURIComponent("%2B") !== "+") { + throw new Test262Error('#8.1: decodeURIComponent("%2B") equal "+", not "%2B"'); +} + +//CHECK#9 +if (decodeURIComponent("%24") !== "$") { + throw new Test262Error('#9: decodeURIComponent("%24") equal "$", not "%24"'); +} + +//CHECK#10 +if (decodeURIComponent("%2C") !== ",") { + throw new Test262Error('#10: decodeURIComponent("%2C") equal ",", not "%2C"'); +} + +//CHECK#11 +if (decodeURIComponent("%23") !== "#") { + throw new Test262Error('#11: decodeURIComponent("%23") equal "#", not "%23"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_T2.js new file mode 100644 index 0000000000..aefd212287 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 reservedURIComponentSet be the empty string +esid: sec-decodeuricomponent-encodeduricomponent +description: > + uriReserved and "#" not in reservedURIComponentSet. HexDigit in + [0..9, a..f] +---*/ + +//CHECK#1 +if (decodeURIComponent("%3b") !== ";") { + throw new Test262Error('#1: decodeURIComponent("%3b") equal ";", not "%3B" or "%3b"'); +} + +//CHECK#2 +if (decodeURIComponent("%2f") !== "/") { + throw new Test262Error('#2: decodeURIComponent("%2f") equal "/", not "%2F" or "%2f"'); +} + +//CHECK#3 +if (decodeURIComponent("%3f") !== "?") { + throw new Test262Error('#3: decodeURIComponent("%3f") equal "?", not "%3F" or "%3f"'); +} + +//CHECK#4 +if (decodeURIComponent("%3a") !== ":") { + throw new Test262Error('#4: decodeURIComponent("%3a") equal ":", not "%3A" or "%3a"'); +} + +//CHECK#5 +if (decodeURIComponent("%40") !== "@") { + throw new Test262Error('#5: decodeURIComponent("%40") equal "@", not "%40"'); +} + +//CHECK#6 +if (decodeURIComponent("%26") !== "&") { + throw new Test262Error('#6: decodeURIComponent("%26") equal "&", not "%26"'); +} + +//CHECK#7 +if (decodeURIComponent("%3d") !== "=") { + throw new Test262Error('#7.1: decodeURIComponent("%3d") equal "=", not "%3D" or "%3d"'); +} + +//CHECK#8 +if (decodeURIComponent("%2b") !== "+") { + throw new Test262Error('#8.1: decodeURIComponent("%2b") equal "+", not "%2B" or "%2b"'); +} + +//CHECK#9 +if (decodeURIComponent("%24") !== "$") { + throw new Test262Error('#9: decodeURIComponent("%24") equal "$", not "%24"'); +} + +//CHECK#10 +if (decodeURIComponent("%2c") !== ",") { + throw new Test262Error('#10: decodeURIComponent("%2c") equal ",", not "%2C" or "%2c"'); +} + +//CHECK#11 +if (decodeURIComponent("%23") !== "#") { + throw new Test262Error('#11: decodeURIComponent("%23") equal "#", not "%23"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_T3.js new file mode 100644 index 0000000000..805b7fb9d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A3_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: Let reservedURIComponentSet be the empty string +esid: sec-decodeuricomponent-encodeduricomponent +description: Complex test +---*/ + +//CHECK#1 +if (decodeURIComponent("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") !== ";/?:@&=+$,#") { + throw new Test262Error('#1: decodeURIComponent("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") equal ";/?:@&=+$,#", not "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23"'); +} + +//CHECK#2 +if (decodeURIComponent("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") !== ";/?:@&=+$,#") { + throw new Test262Error('#2: decodeURIComponent("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") equal ";/?:@&=+$,#" or "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23", not "%3b%2f%3f%3a%40%26%3d%2b%24%2c%23"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T1.js new file mode 100644 index 0000000000..946e5f08f1 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: Checking ENGLISH ALPHABET +---*/ + +//CHECK#1 +if (decodeURIComponent("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") { + throw new Test262Error('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (decodeURIComponent("%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") { + throw new Test262Error('#2: ABCDEFGHIJKLMNOPQRSTUVWXYZ'); +} + +//CHECK#3 +if (decodeURIComponent("%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") { + throw new Test262Error('#3: abcdefghijklmnopqrstuvwxyz'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T2.js new file mode 100644 index 0000000000..7ae18a5721 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: Checking RUSSIAN ALPHABET +---*/ + +//CHECK#1 +if (decodeURIComponent("http://ru.wikipedia.org/wiki/%d0%ae%D0%bd%D0%B8%D0%BA%D0%BE%D0%B4") !== "http://ru.wikipedia.org/wiki/Юникод") { + throw new Test262Error('#1: http://ru.wikipedia.org/wiki/Юникод'); +} + +//CHECK#2 +if (decodeURIComponent("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/Юникод#Ссылки") { + throw new Test262Error('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки'); +} + +//CHECK#3 +if (decodeURIComponent("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/Юникод#Версии Юникода") { + throw new Test262Error('#3: http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T3.js new file mode 100644 index 0000000000..81f5b73f60 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: Checking URL with Line Terminator +---*/ + +//CHECK#1 +if (decodeURIComponent("http://unipro.ru/%0Aabout") !== "http://unipro.ru/\nabout") { + throw new Test262Error('#1: http://unipro.ru/%A0about'); +} + +//CHECK#2 +if (decodeURIComponent("http://unipro.ru/%0Babout") !== "http://unipro.ru/\vabout") { + throw new Test262Error('#2: http://unipro.ru/%0Babout'); +} + +//CHECK#3 +if (decodeURIComponent("http://unipro.ru/%0Cabout") !== "http://unipro.ru/\fabout") { + throw new Test262Error('#3: http://unipro.ru/%0Cabout'); +} + +//CHECK#4 +if (decodeURIComponent("http://unipro.ru/%0Dabout") !== "http://unipro.ru/\rabout") { + throw new Test262Error('#4: http://unipro.ru/%0Dabout'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T4.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A4_T4.js new file mode 100644 index 0000000000..8cf0f45981 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: Test some url +---*/ + +//CHECK#1 +if (decodeURIComponent("") !== "") { + throw new Test262Error('#1: ""'); +} + +//CHECK#2 +if (decodeURIComponent("http://unipro.ru") !== "http://unipro.ru") { + throw new Test262Error('#2: http://unipro.ru'); +} + +//CHECK#3 +if (decodeURIComponent("http:%2f%2Fwww.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") !== "http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") { + throw new Test262Error('#3: http:%2f%2Fwww.google.ru/support/jobs/bin/static.py%3Fpage3dwhy-ru.html%26sid3Dliveandwork"'); +} + +//CHECK#4 +if (decodeURIComponent("http:%2F%2Fen.wikipedia.org/wiki/UTF-8%23Description") !== "http://en.wikipedia.org/wiki/UTF-8#Description") { + throw new Test262Error('#4: http:%2F%2Fen.wikipedia.org/wiki/UTF-8%23Description'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.1.js new file mode 100644 index 0000000000..6bcb5c89d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent has the attribute DontEnum +esid: sec-decodeuricomponent-encodeduricomponent +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (decodeURIComponent.propertyIsEnumerable('length') !== false) { + throw new Test262Error('#1: decodeURIComponent.propertyIsEnumerable(\'length\') === false. Actual: ' + (decodeURIComponent.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (var p in decodeURIComponent) { + if (p === "length") { + result = false; + } +} + +if (result !== true) { + throw new Test262Error('#2: result = true; for (p in decodeURIComponent) { if (p === "length") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.2.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.2.js new file mode 100644 index 0000000000..ae030203fe --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.2.js @@ -0,0 +1,29 @@ +// 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 decodeURIComponent does not have the attribute + DontDelete +esid: sec-decodeuricomponent-encodeduricomponent +description: Checking use hasOwnProperty, delete +---*/ + +//CHECK#1 +if (decodeURIComponent.hasOwnProperty('length') !== true) { + throw new Test262Error('#1: decodeURIComponent.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURIComponent.hasOwnProperty('length'))); +} + +delete decodeURIComponent.length; + +//CHECK#2 +if (decodeURIComponent.hasOwnProperty('length') !== false) { + throw new Test262Error('#2: delete decodeURIComponent.length; decodeURIComponent.hasOwnProperty(\'length\') === false. Actual: ' + (decodeURIComponent.hasOwnProperty('length'))); +} + +//CHECK#3 +if (decodeURIComponent.length === undefined) { + throw new Test262Error('#3: delete decodeURIComponent.length; decodeURIComponent.length !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.3.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.3.js new file mode 100644 index 0000000000..dfefb88cdd --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent has the attribute ReadOnly +esid: sec-decodeuricomponent-encodeduricomponent +description: Checking if varying the length property fails +includes: [propertyHelper.js] +---*/ + +//CHECK#1 +var x = decodeURIComponent.length; +verifyNotWritable(decodeURIComponent, "length", null, Infinity); +if (decodeURIComponent.length !== x) { + throw new Test262Error('#1: x = decodeURIComponent.length; decodeURIComponent.length = Infinity; decodeURIComponent.length === x. Actual: ' + (decodeURIComponent.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.4.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.4.js new file mode 100644 index 0000000000..1d1ace033d --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent is 1 +esid: sec-decodeuricomponent-encodeduricomponent +description: decodeURIComponent.length === 1 +---*/ + +//CHECK#1 +if (decodeURIComponent.length !== 1) { + throw new Test262Error('#1: decodeURIComponent.length === 1. Actual: ' + (decodeURIComponent.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.5.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.5.js new file mode 100644 index 0000000000..4752fec435 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent property has the attribute DontEnum +esid: sec-decodeuricomponent-encodeduricomponent +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (this.propertyIsEnumerable('decodeURIComponent') !== false) { + throw new Test262Error('#1: this.propertyIsEnumerable(\'decodeURIComponent\') === false. Actual: ' + (this.propertyIsEnumerable('decodeURIComponent'))); +} + +//CHECK#2 +var result = true; +for (var p in this) { + if (p === "decodeURIComponent") { + result = false; + } +} + +if (result !== true) { + throw new Test262Error('#2: result = true; for (p in this) { if (p === "decodeURIComponent") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.6.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.6.js new file mode 100644 index 0000000000..1f144a9048 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent property has not prototype property +esid: sec-decodeuricomponent-encodeduricomponent +description: Checking decodeURIComponent.prototype +---*/ + +//CHECK#1 +if (decodeURIComponent.prototype !== undefined) { + throw new Test262Error('#1: decodeURIComponent.prototype === undefined. Actual: ' + (decodeURIComponent.prototype)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.7.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A5.7.js new file mode 100644 index 0000000000..c031e56c82 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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 decodeURIComponent property can't be used as constructor +esid: sec-decodeuricomponent-encodeduricomponent +description: > + If property does not implement the internal [[Construct]] method, + throw a TypeError exception +---*/ + +//CHECK#1 + +try { + new decodeURIComponent(); + throw new Test262Error('#1.1: new decodeURIComponent() throw TypeError. Actual: ' + (new decodeURIComponent())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: new decodeURIComponent() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A6_T1.js b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_A6_T1.js new file mode 100644 index 0000000000..4b17ed6db9 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/S15.1.3.2_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-decodeuricomponent-encodeduricomponent +description: If Type(value) is Object, evaluate ToPrimitive(value, String) +---*/ + +//CHECK#1 +var object = { + valueOf: function() { + return "%5E" + } +}; +if (decodeURIComponent(object) !== "[object Object]") { + throw new Test262Error('#1: var object = {valueOf: function() {return "%5E"}}; decodeURIComponent(object) === [object Object]. Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#2 +var object = { + valueOf: function() { + return "" + }, + toString: function() { + return "%5E" + } +}; +if (decodeURIComponent(object) !== "^") { + throw new Test262Error('#2: var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#3 +var object = { + valueOf: function() { + return "%5E" + }, + toString: function() { + return {} + } +}; +if (decodeURIComponent(object) !== "^") { + throw new Test262Error('#3: var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#4 +try { + var object = { + valueOf: function() { + throw "error" + }, + toString: function() { + return "%5E" + } + }; + if (decodeURIComponent(object) !== "^") { + throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = { + toString: function() { + return "%5E" + } +}; +if (decodeURIComponent(object) !== "^") { + throw new Test262Error('#5: var object = {toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#6 +var object = { + valueOf: function() { + return {} + }, + toString: function() { + return "%5E" + } +} +if (decodeURIComponent(object) !== "^") { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#7 +try { + var object = { + valueOf: function() { + return "%5E" + }, + toString: function() { + throw "error" + } + }; + decodeURIComponent(object); + throw new Test262Error('#7.1: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURIComponent(object) throw "error". Actual: ' + (decodeURIComponent(object))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURIComponent(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = { + valueOf: function() { + return {} + }, + toString: function() { + return {} + } + }; + decodeURIComponent(object); + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURIComponent(object) throw TypeError. Actual: ' + (decodeURIComponent(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURIComponent(object) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/browser.js b/js/src/tests/test262/built-ins/decodeURIComponent/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/browser.js diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/name.js b/js/src/tests/test262/built-ins/decodeURIComponent/name.js new file mode 100644 index 0000000000..35d153a3e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/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-decodeuricomponent-encodeduricomponent +description: > + decodeURIComponent.name is "decodeURIComponent". +info: | + decodeURIComponent (encodedURIComponent) + + 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(decodeURIComponent.name, "decodeURIComponent"); + +verifyNotEnumerable(decodeURIComponent, "name"); +verifyNotWritable(decodeURIComponent, "name"); +verifyConfigurable(decodeURIComponent, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/not-a-constructor.js b/js/src/tests/test262/built-ins/decodeURIComponent/not-a-constructor.js new file mode 100644 index 0000000000..dcb99027df --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/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: > + decodeURIComponent 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(decodeURIComponent), false, 'isConstructor(decodeURIComponent) must return false'); + +assert.throws(TypeError, () => { + new decodeURIComponent(''); +}, '`new decodeURIComponent(\'\')` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/prop-desc.js b/js/src/tests/test262/built-ins/decodeURIComponent/prop-desc.js new file mode 100644 index 0000000000..e3da7b0806 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/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-decodeuricomponent-encodeduricomponent +description: Property descriptor for decodeURIComponent +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, "decodeURIComponent"); +verifyWritable(this, "decodeURIComponent"); +verifyConfigurable(this, "decodeURIComponent"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/decodeURIComponent/shell.js b/js/src/tests/test262/built-ins/decodeURIComponent/shell.js new file mode 100644 index 0000000000..a9bb766df3 --- /dev/null +++ b/js/src/tests/test262/built-ins/decodeURIComponent/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; +} |