summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js
new file mode 100644
index 0000000000..28f5cda441
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/of/custom-ctor-returns-smaller-instance-throws.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.of
+description: >
+ Throws a TypeError if a custom `this` returns a smaller instance
+info: |
+ %TypedArray%.of ( ...items )
+
+ 1. Let len be the actual number of arguments passed to this function.
+ ...
+ 5. Let newObj be ? TypedArrayCreate(C, « len »).
+ ...
+includes: [testTypedArray.js]
+features: [TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var ctor = function() {
+ return new TA(1);
+ };
+
+ assert.throws(TypeError, function() {
+ TypedArray.of.call(ctor, 1, 2);
+ });
+});
+
+reportCompare(0, 0);