summaryrefslogtreecommitdiff
path: root/test/built-ins/Date/prototype/toString
diff options
context:
space:
mode:
authorDaniel Ehrenberg <littledan@chromium.org>2017-03-21 10:44:32 +0100
committerDaniel Ehrenberg <littledan@chromium.org>2017-03-21 10:51:53 +0100
commit7151f3247e8614a952273347fc1d6fdcdf68a441 (patch)
tree03d021ac4782541394fff6e1e389834320360397 /test/built-ins/Date/prototype/toString
parent975e54de17ede3d8802dd7411181dbbc29147308 (diff)
downloadqtdeclarative-testsuites-7151f3247e8614a952273347fc1d6fdcdf68a441.tar.gz
Test that Date.prototype.toString throws for non-Date receiver
Pending discussion of https://github.com/tc39/ecma262/issues/849 Test passes in V8.
Diffstat (limited to 'test/built-ins/Date/prototype/toString')
-rw-r--r--test/built-ins/Date/prototype/toString/non-date-receiver.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/built-ins/Date/prototype/toString/non-date-receiver.js b/test/built-ins/Date/prototype/toString/non-date-receiver.js
new file mode 100644
index 000000000..2955654b5
--- /dev/null
+++ b/test/built-ins/Date/prototype/toString/non-date-receiver.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2017 V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: #sec-date.prototype.tostring
+description: Date.prototype.toString throws a TypeError on non-Date receivers
+---*/
+
+assert.throws(TypeError, () => Date.prototype.toString());
+assert.throws(TypeError, () => Date.prototype.toString.call(undefined));
+assert.throws(TypeError, () => Date.prototype.toString.call(0));
+assert.throws(TypeError, () => Date.prototype.toString.call({}));