improve test

This commit is contained in:
alexlamsl 2017-11-03 19:30:17 +08:00
parent 8334f86f30
commit 75be179054

View File

@ -3345,41 +3345,37 @@ issue_2420_2: {
} }
input: { input: {
function f() { function f() {
var t = this; var that = this;
if (t.bar) if (that.bar)
t.foo(); that.foo();
else else
!function(t) { !function(that, self) {
console.log(this === t); console.log(this === that, self === this, that === self);
}(this); }(that, this);
} }
var o = { f.call({
bar: 1, bar: 1,
foo: function() { console.log("foo", this.bar); }, foo: function() { console.log("foo", this.bar); },
}; });
f.call(o); f.call({});
o.bar = 0;
f.call(o);
} }
expect: { expect: {
function f() { function f() {
if (this.bar) if (this.bar)
this.foo(); this.foo();
else else
!function(t) { !function(that, self) {
console.log(this === t); console.log(this === that, self === this, that === self);
}(this); }(this, this);
} }
var o = { f.call({
bar: 1, bar: 1,
foo: function() { console.log("foo", this.bar); }, foo: function() { console.log("foo", this.bar); },
}; });
f.call(o); f.call({});
o.bar = 0;
f.call(o);
} }
expect_stdout: [ expect_stdout: [
"foo 1", "foo 1",
"false", "false false true",
] ]
} }