Skip to content

Commit a2709e7

Browse files
Test for opt-call of root function
1 parent 0abf9c2 commit a2709e7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/es12/optional-calls.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ const tests = [
110110
assert.areEqual(42, (specialObj?.b)?.().c);
111111
}
112112
},
113+
{
114+
name: "Optional call of root function",
115+
body(){
116+
assert.areEqual(42, eval?.("42"));
117+
118+
globalThis.doNotUseThisBadGlobalFunction = () => 42;
119+
assert.areEqual(42, doNotUseThisBadGlobalFunction?.());
120+
assert.areEqual(42, eval("doNotUseThisBadGlobalFunction?.()"));
121+
}
122+
},
113123
{
114124
name: "Optional call in eval (function)",
115125
body() {

0 commit comments

Comments
 (0)