Skip to content

Commit

Permalink
Testcase for 'global' binding
Browse files Browse the repository at this point in the history
  • Loading branch information
svaarala committed Jan 2, 2017
1 parent 6120d4e commit ef72a15
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/ecmascript/test-bi-global-global-binding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 'global' binding based on https://github.com/tc39/proposal-global
*/

/*===
object
true
object
true
true
false
true
===*/

function test() {
var pd, g;

// Standard trick to access global object.
g = new Function('return this')();

// proposal-global provides 'global' for cleaner standard access.
print(typeof global);
print(g === global);

// Attributes in current proposal.
pd = Object.getOwnPropertyDescriptor(g, 'global');
print(typeof pd);
if (pd) {
print(pd.value === g);
print(pd.writable);
print(pd.enumerable);
print(pd.configurable);
}
}

try {
test();
} catch (e) {
print(e.stack || e);
}

0 comments on commit ef72a15

Please sign in to comment.