mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	Prior to this patch, two distinct failure cases would produce the same generic error message. Refactor the test logic to report the specific condition which trigger failure.
		
			
				
	
	
		
			24 lines
		
	
	
		
			678 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			678 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
 | 
						|
esid: sec-decodeuri-encodeduri
 | 
						|
description: Complex tests
 | 
						|
includes: [decimalToHexString.js]
 | 
						|
---*/
 | 
						|
 | 
						|
for (var indexI = 0; indexI <= 65535; indexI++) {
 | 
						|
  if (indexI !== 0x25) {
 | 
						|
    try {
 | 
						|
      var str = String.fromCharCode(indexI);
 | 
						|
      var differs = decodeURI(str) !== str;
 | 
						|
    } catch (e) {
 | 
						|
      throw new Test262Error('#' + decimalToHexString(indexI) + ' throws');
 | 
						|
    }
 | 
						|
    if (differs) {
 | 
						|
      throw new Test262Error('#' + decimalToHexString(indexI) + ' differs');
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 |