mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Add abrupt completion tests
This commit is contained in:
parent
8551382805
commit
b6cc89c61d
31
test/built-ins/Function/prototype/apply/get-index-abrupt.js
vendored
Normal file
31
test/built-ins/Function/prototype/apply/get-index-abrupt.js
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2019 Aleksey Shvayka. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-function.prototype.apply
|
||||
description: >
|
||||
Return abrupt completion from Get(obj, indexName)
|
||||
info: |
|
||||
Function.prototype.apply ( thisArg, argArray )
|
||||
|
||||
[...]
|
||||
4. Let argList be ? CreateListFromArrayLike(argArray).
|
||||
|
||||
CreateListFromArrayLike ( obj [ , elementTypes ] )
|
||||
|
||||
[...]
|
||||
6. Repeat, while index < len
|
||||
a. Let indexName be ! ToString(index).
|
||||
b. Let next be ? Get(obj, indexName).
|
||||
---*/
|
||||
|
||||
var arrayLike = {
|
||||
length: 2,
|
||||
0: 0,
|
||||
get 1() {
|
||||
throw new Test262Error();
|
||||
},
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
(function() {}).apply(null, arrayLike);
|
||||
});
|
27
test/built-ins/Function/prototype/apply/get-length-abrupt.js
vendored
Normal file
27
test/built-ins/Function/prototype/apply/get-length-abrupt.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright 2019 Aleksey Shvayka. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-function.prototype.apply
|
||||
description: >
|
||||
Return abrupt completion from Get(obj, "length")
|
||||
info: |
|
||||
Function.prototype.apply ( thisArg, argArray )
|
||||
|
||||
[...]
|
||||
4. Let argList be ? CreateListFromArrayLike(argArray).
|
||||
|
||||
CreateListFromArrayLike ( obj [ , elementTypes ] )
|
||||
|
||||
[...]
|
||||
3. Let len be ? ToLength(? Get(obj, "length")).
|
||||
---*/
|
||||
|
||||
var arrayLike = {
|
||||
get length() {
|
||||
throw new Test262Error();
|
||||
},
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
(function() {}).apply(null, arrayLike);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user