mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 11:44:31 +01:00 
			
		
		
		
	Eliminate false positives: Intl.*
This commit is contained in:
		
							parent
							
								
									86deb370e7
								
							
						
					
					
						commit
						3b09d0e2b5
					
				| @ -12,6 +12,8 @@ info: | | ||||
| features: [Intl.ListFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| assert.sameValue(typeof Intl.ListFormat, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, function() { | ||||
|   Intl.ListFormat(); | ||||
| }); | ||||
|  | ||||
| @ -11,4 +11,7 @@ info: | | ||||
| features: [Intl.ListFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| assert.throws(TypeError, function() { new Intl.ListFormat([], null) }) | ||||
| assert.sameValue(typeof Intl.ListFormat, "function"); | ||||
| assert.throws(TypeError, function() { | ||||
|   new Intl.ListFormat([], null); | ||||
| }); | ||||
|  | ||||
| @ -12,14 +12,16 @@ info: | | ||||
| features: [Intl.ListFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.ListFormat.prototype.format; | ||||
| const format = Intl.ListFormat.prototype.format; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
| assert.sameValue(typeof format, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => format.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => format.call(null), "null"); | ||||
| assert.throws(TypeError, () => format.call(true), "true"); | ||||
| assert.throws(TypeError, () => format.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => format.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => format.call(1), "1"); | ||||
| assert.throws(TypeError, () => format.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => format.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => format.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
|  | ||||
| @ -12,14 +12,15 @@ info: | | ||||
| features: [Intl.ListFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.ListFormat.prototype.formatToParts; | ||||
| const formatToParts = Intl.ListFormat.prototype.formatToParts; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
| assert.sameValue(typeof formatToParts, "function"); | ||||
| assert.throws(TypeError, () => formatToParts.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => formatToParts.call(null), "null"); | ||||
| assert.throws(TypeError, () => formatToParts.call(true), "true"); | ||||
| assert.throws(TypeError, () => formatToParts.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => formatToParts.call(1), "1"); | ||||
| assert.throws(TypeError, () => formatToParts.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
|  | ||||
| @ -12,14 +12,15 @@ info: | | ||||
| features: [Intl.ListFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.ListFormat.prototype.resolvedOptions; | ||||
| const resolvedOptions = Intl.ListFormat.prototype.resolvedOptions; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
| assert.sameValue(typeof resolvedOptions, "function"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(null), "null"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(true), "true"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(1), "1"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat), "Intl.ListFormat"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); | ||||
|  | ||||
| @ -13,7 +13,10 @@ info: | | ||||
| features: [Intl.Locale] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Locale.prototype.maximize; | ||||
| const maximize = Intl.Locale.prototype.maximize; | ||||
| 
 | ||||
| assert.sameValue(typeof maximize, "function"); | ||||
| 
 | ||||
| const invalidValues = [ | ||||
|   undefined, | ||||
|   null, | ||||
| @ -26,5 +29,5 @@ const invalidValues = [ | ||||
| ]; | ||||
| 
 | ||||
| for (const invalidValue of invalidValues) { | ||||
|   assert.throws(TypeError, () => fn.call(invalidValue)); | ||||
|   assert.throws(TypeError, () => maximize.call(invalidValue)); | ||||
| } | ||||
|  | ||||
| @ -13,7 +13,10 @@ info: | | ||||
| features: [Intl.Locale] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Locale.prototype.minimize; | ||||
| const minimize = Intl.Locale.prototype.minimize; | ||||
| 
 | ||||
| assert.sameValue(typeof minimize, "function"); | ||||
| 
 | ||||
| const invalidValues = [ | ||||
|   undefined, | ||||
|   null, | ||||
| @ -26,5 +29,5 @@ const invalidValues = [ | ||||
| ]; | ||||
| 
 | ||||
| for (const invalidValue of invalidValues) { | ||||
|   assert.throws(TypeError, () => fn.call(invalidValue)); | ||||
|   assert.throws(TypeError, () => minimize.call(invalidValue)); | ||||
| } | ||||
|  | ||||
| @ -13,7 +13,10 @@ info: | | ||||
| features: [Intl.Locale] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Locale.prototype.toString; | ||||
| const toString = Intl.Locale.prototype.toString; | ||||
| 
 | ||||
| assert.sameValue(typeof toString, "function"); | ||||
| 
 | ||||
| const invalidValues = [ | ||||
|   undefined, | ||||
|   null, | ||||
| @ -26,5 +29,5 @@ const invalidValues = [ | ||||
| ]; | ||||
| 
 | ||||
| for (const invalidValue of invalidValues) { | ||||
|   assert.throws(TypeError, () => fn.call(invalidValue)); | ||||
|   assert.throws(TypeError, () => toString.call(invalidValue)); | ||||
| } | ||||
|  | ||||
| @ -10,7 +10,10 @@ info: | | ||||
| features: [Intl.RelativeTimeFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.RelativeTimeFormat.supportedLocalesOf; | ||||
| const supportedLocalesOf = Intl.RelativeTimeFormat.supportedLocalesOf; | ||||
| 
 | ||||
| assert.sameValue(typeof supportedLocalesOf, "function"); | ||||
| 
 | ||||
| const thisValues = [ | ||||
|   undefined, | ||||
|   null, | ||||
| @ -24,6 +27,6 @@ const thisValues = [ | ||||
| ]; | ||||
| 
 | ||||
| for (const thisValue of thisValues) { | ||||
|   const result = fn.call(thisValue); | ||||
|   const result = supportedLocalesOf.call(thisValue); | ||||
|   assert.sameValue(Array.isArray(result), true); | ||||
| } | ||||
|  | ||||
| @ -11,14 +11,16 @@ info: | | ||||
| features: [Intl.RelativeTimeFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.RelativeTimeFormat.prototype.format; | ||||
| const format = Intl.RelativeTimeFormat.prototype.format; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
| assert.sameValue(typeof format, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => format.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => format.call(null), "null"); | ||||
| assert.throws(TypeError, () => format.call(true), "true"); | ||||
| assert.throws(TypeError, () => format.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => format.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => format.call(1), "1"); | ||||
| assert.throws(TypeError, () => format.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
|  | ||||
| @ -11,14 +11,16 @@ info: | | ||||
| features: [Intl.RelativeTimeFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.RelativeTimeFormat.prototype.formatToParts; | ||||
| const formatToParts = Intl.RelativeTimeFormat.prototype.formatToParts; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
| assert.sameValue(typeof formatToParts, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => formatToParts.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => formatToParts.call(null), "null"); | ||||
| assert.throws(TypeError, () => formatToParts.call(true), "true"); | ||||
| assert.throws(TypeError, () => formatToParts.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => formatToParts.call(1), "1"); | ||||
| assert.throws(TypeError, () => formatToParts.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => formatToParts.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
|  | ||||
| @ -11,14 +11,16 @@ info: | | ||||
| features: [Intl.RelativeTimeFormat] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.RelativeTimeFormat.prototype.resolvedOptions; | ||||
| const resolvedOptions = Intl.RelativeTimeFormat.prototype.resolvedOptions; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
| assert.sameValue(typeof resolvedOptions, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(null), "null"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(true), "true"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(1), "1"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); | ||||
|  | ||||
| @ -10,7 +10,10 @@ info: | | ||||
| features: [Intl.Segmenter] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Segmenter.supportedLocalesOf; | ||||
| const supportedLocalesOf = Intl.Segmenter.supportedLocalesOf; | ||||
| 
 | ||||
| assert.sameValue(typeof supportedLocalesOf, "function"); | ||||
| 
 | ||||
| const thisValues = [ | ||||
|   undefined, | ||||
|   null, | ||||
| @ -24,6 +27,6 @@ const thisValues = [ | ||||
| ]; | ||||
| 
 | ||||
| for (const thisValue of thisValues) { | ||||
|   const result = fn.call(thisValue); | ||||
|   const result = supportedLocalesOf.call(thisValue); | ||||
|   assert.sameValue(Array.isArray(result), true); | ||||
| } | ||||
|  | ||||
| @ -11,14 +11,16 @@ info: | | ||||
| features: [Intl.Segmenter] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Segmenter.prototype.resolvedOptions; | ||||
| const resolvedOptions = Intl.Segmenter.prototype.resolvedOptions; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); | ||||
| assert.sameValue(typeof resolvedOptions, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(null), "null"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(true), "true"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(1), "1"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter), "Intl.Segmenter"); | ||||
| assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); | ||||
|  | ||||
| @ -11,14 +11,16 @@ info: | | ||||
| features: [Intl.Segmenter] | ||||
| ---*/ | ||||
| 
 | ||||
| const fn = Intl.Segmenter.prototype.segment; | ||||
| const segment = Intl.Segmenter.prototype.segment; | ||||
| 
 | ||||
| assert.throws(TypeError, () => fn.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => fn.call(null), "null"); | ||||
| assert.throws(TypeError, () => fn.call(true), "true"); | ||||
| assert.throws(TypeError, () => fn.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => fn.call(1), "1"); | ||||
| assert.throws(TypeError, () => fn.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter"); | ||||
| assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); | ||||
| assert.sameValue(typeof segment, "function"); | ||||
| 
 | ||||
| assert.throws(TypeError, () => segment.call(undefined), "undefined"); | ||||
| assert.throws(TypeError, () => segment.call(null), "null"); | ||||
| assert.throws(TypeError, () => segment.call(true), "true"); | ||||
| assert.throws(TypeError, () => segment.call(""), "empty string"); | ||||
| assert.throws(TypeError, () => segment.call(Symbol()), "symbol"); | ||||
| assert.throws(TypeError, () => segment.call(1), "1"); | ||||
| assert.throws(TypeError, () => segment.call({}), "plain object"); | ||||
| assert.throws(TypeError, () => segment.call(Intl.Segmenter), "Intl.Segmenter"); | ||||
| assert.throws(TypeError, () => segment.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user