mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 13:34:38 +02:00
Add unary operators with NewTarget test (#2199)
This commit is contained in:
parent
f7f07a9010
commit
14b6bec36d
31
test/language/expressions/new.target/unary-expr.js
Normal file
31
test/language/expressions/new.target/unary-expr.js
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: prod-UnaryExpression
|
||||
description: >
|
||||
While increments and decrements are restricted to use with NewTarget,
|
||||
other unary operators should not throw SyntaxError.
|
||||
info: |
|
||||
UnaryExpression[Yield, Await]:
|
||||
UpdateExpression[?Yield, ?Await]:
|
||||
LeftHandSideExpression[?Yield, ?Await]:
|
||||
NewExpression[?Yield, ?Await]:
|
||||
MemberExpression[Yield, Await]:
|
||||
MetaProperty:
|
||||
NewTarget
|
||||
features: [new.target, async-functions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
(function() { assert.sameValue(delete (new.target), true); })();
|
||||
(function() { assert.sameValue(void new.target, undefined); })();
|
||||
new function() { assert.sameValue(typeof new.target, 'function'); };
|
||||
new function() { assert.sameValue(+(new.target), NaN); };
|
||||
(function() { assert.sameValue(-(new.target), NaN); })();
|
||||
new function() { assert.sameValue(~new.target, -1); };
|
||||
(function() { assert.sameValue(!new.target, true); })();
|
||||
new function() { assert.sameValue(delete void typeof +-~!(new.target), true); };
|
||||
|
||||
(async function() {
|
||||
assert.sameValue(await new.target, undefined);
|
||||
})().then($DONE, $DONE);
|
Loading…
x
Reference in New Issue
Block a user