summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.js')
-rw-r--r--js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.js b/js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.js
new file mode 100644
index 0000000000..fe367827b0
--- /dev/null
+++ b/js/src/tests/test262/annexB/built-ins/String/prototype/substr/length-to-int-err.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-string.prototype.substr
+es6id: B.2.3.1
+description: >
+ Behavior when "length" integer conversion triggers an abrupt completion
+info: |
+ [...]
+ 3. Let intStart be ? ToInteger(start).
+features: [Symbol]
+---*/
+
+var symbol = Symbol('');
+var len = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ ''.substr(0, len);
+});
+
+assert.throws(TypeError, function() {
+ ''.substr(0, symbol);
+});
+
+reportCompare(0, 0);