From 8b7c610232ea8b4f4af50a52207d8badd3106260 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Fri, 16 Jul 2021 13:58:30 -0400 Subject: [PATCH] tests: Realm.prototype.evaluate validate realm object --- .../evaluate/validates-realm-object.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/built-ins/Realm/prototype/evaluate/validates-realm-object.js diff --git a/test/built-ins/Realm/prototype/evaluate/validates-realm-object.js b/test/built-ins/Realm/prototype/evaluate/validates-realm-object.js new file mode 100644 index 0000000000..1f024de931 --- /dev/null +++ b/test/built-ins/Realm/prototype/evaluate/validates-realm-object.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-realm.prototype.evaluate +description: > + Realm.prototype.evaluate validates realm object. +includes: [isConstructor.js] +features: [callable-boundary-realms] +---*/ + +assert.sameValue( + typeof Realm.prototype.evaluate, + 'function', + 'This test must fail if Realm.prototype.evaluate is not a function' +); + +const r = new Realm(); +const bogus = {}; + +assert.throws(TypeError, function() { + r.evaluate.call(bogus); +}, 'throws a TypeError if this is not a Realm object'); \ No newline at end of file