mirror of
https://github.com/tc39/test262.git
synced 2025-05-29 19:20:30 +02:00
* Move decimalToHexString into harness instead of duplicating it in multiple files * Optimize decimalToHexString and support numbers greater than 65535 * Replace alternative decimalToHexString function with include for decimalToHexString.js * Add decimalToHex2String to return the string representation of a two-digit hex-number * Replace decimalToHex2String with decimalToPercentHexString to return the percent hex-encoded string of a two-digit hex-number * Replace two String.fromCharCode calls with a single call * Further reduce string concatentations in decodeURI[Component] tests * Remove unnecessary Test262Error error handling in catch-clauses * Remove try/catch wrappings in decodeURI/encodeURI tests
34 lines
819 B
JavaScript
34 lines
819 B
JavaScript
// 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
|
|
es5id: 15.1.3.1_A2.1_T1
|
|
description: Complex tests
|
|
includes: [decimalToHexString.js]
|
|
---*/
|
|
|
|
//CHECK
|
|
var errorCount = 0;
|
|
var count = 0;
|
|
for (var indexI = 0; indexI <= 65535; indexI++) {
|
|
if (indexI !== 0x25) {
|
|
var hex = decimalToHexString(indexI);
|
|
try {
|
|
var str = String.fromCharCode(indexI);
|
|
if (decodeURI(str) !== str) {
|
|
$ERROR('#' + hex + ' ');
|
|
errorCount++;
|
|
}
|
|
} catch (e){
|
|
$ERROR('#' + hex + ' ');
|
|
errorCount++;
|
|
}
|
|
count++;
|
|
}
|
|
}
|
|
|
|
if (errorCount > 0) {
|
|
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
|
|
}
|