File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,15 @@ TypeError : The value of the property 'toLocaleString' is not a Function object
43
43
44
44
9. Array: toLocaleString should use length property
45
45
10.00, 20.00, 30.00, , ,
46
+
47
+
48
+ 10. Array: toLocaleString should use toLocaleString accessor on element
49
+ accessor-value
50
+
51
+
52
+ 11. Array: toLocaleString should throw TypeError on undefined
53
+ TypeError : Cannot redefine non-configurable property 'toLocaleString'
54
+
55
+
56
+ 12. Array: toLocaleString should throw TypeError on invalid function
57
+ TypeError : Cannot redefine non-configurable property 'toLocaleString'
Original file line number Diff line number Diff line change @@ -184,3 +184,36 @@ guarded_call(function () {
184
184
echo ( output ) ;
185
185
}
186
186
} ) ;
187
+
188
+ scenario ( "Array: toLocaleString should use toLocaleString accessor on element" ) ;
189
+ var o = [ "test" ] ;
190
+ guarded_call ( function ( ) {
191
+ Object . defineProperty ( String . prototype , "toLocaleString" , {
192
+ get ( ) {
193
+ return function ( ) { return "accessor-value" ; } ;
194
+ }
195
+ } ) ;
196
+ echo ( Array . prototype . toLocaleString . apply ( o ) ) ;
197
+ } ) ;
198
+
199
+ scenario ( "Array: toLocaleString should throw TypeError on undefined" ) ;
200
+ var o = [ "test" ] ;
201
+ guarded_call ( function ( ) {
202
+ Object . defineProperty ( String . prototype , "toLocaleString" , {
203
+ get ( ) {
204
+ return undefined ;
205
+ }
206
+ } ) ;
207
+ echo ( Array . prototype . toLocaleString . apply ( o ) ) ;
208
+ } ) ;
209
+
210
+ scenario ( "Array: toLocaleString should throw TypeError on invalid function" ) ;
211
+ var o = [ "test" ] ;
212
+ guarded_call ( function ( ) {
213
+ Object . defineProperty ( String . prototype , "toLocaleString" , {
214
+ get ( ) {
215
+ return 0 ;
216
+ }
217
+ } ) ;
218
+ echo ( Array . prototype . toLocaleString . apply ( o ) ) ;
219
+ } ) ;
You can’t perform that action at this time.
0 commit comments