Merge pull request #3407 from babel/async-tests

Async context tests
This commit is contained in:
Amjad Masad
2016-03-08 02:00:40 -08:00
5 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
function f() {
let g = async () => {
this;
};
};

View File

@@ -0,0 +1,12 @@
function f() {
var _this = this;
let g = function () {
var ref = babelHelpers.asyncToGenerator(function* () {
_this;
});
return function g() {
return ref.apply(this, arguments);
};
}();
};

View File

@@ -0,0 +1,8 @@
{
"plugins": [
"transform-es2015-arrow-functions",
"syntax-async-functions",
"transform-async-to-generator",
"external-helpers"
]
}

View File

@@ -0,0 +1,23 @@
class Bar {
test() {
// pass
(() => {
assert.strictEqual(this.constructor, Bar);
})();
// pass
(() => {
assert.strictEqual(this.constructor, Bar);
}).call(this);
(async () => {
assert.strictEqual(this.constructor, Bar);
})();
(async () => {
assert.strictEqual(this.constructor, Bar);
}).call(this);
}
}
(new Bar()).test();

View File

@@ -0,0 +1,4 @@
{
"plugins": ["transform-async-to-generator"],
"presets": ["es2015"]
}