2019-08-23 05:03:38 +08:00
|
|
|
"use strict"
|
2017-07-12 01:08:23 +08:00
|
|
|
|
2019-08-23 05:03:38 +08:00
|
|
|
import d, {a, b as B} from "./abc"
|
2017-07-12 01:08:23 +08:00
|
|
|
|
2019-08-23 05:03:38 +08:00
|
|
|
import * as abc from "./abc"
|
2017-07-12 01:08:23 +08:00
|
|
|
|
|
|
|
|
function x() { throw new Error("should not be executed"); }
|
|
|
|
|
it("should have this = undefined on imported non-strict functions", function() {
|
2019-08-23 05:03:38 +08:00
|
|
|
if(true) x
|
|
|
|
|
d().toBe("undefined")
|
2017-07-12 01:08:23 +08:00
|
|
|
x
|
2019-08-23 05:03:38 +08:00
|
|
|
a().toBe("undefined")
|
2017-07-12 01:08:23 +08:00
|
|
|
x
|
2019-08-23 05:03:38 +08:00
|
|
|
B().toBe("undefined")
|
|
|
|
|
})
|
2017-07-12 01:08:23 +08:00
|
|
|
|
2019-08-23 05:03:38 +08:00
|
|
|
import C2, { C } from "./new"
|
2017-07-12 01:08:23 +08:00
|
|
|
|
2019-08-23 05:03:38 +08:00
|
|
|
import * as New from "./new"
|
2017-07-12 01:08:23 +08:00
|
|
|
|
|
|
|
|
it("should be possible to use new correctly", function() {
|
|
|
|
|
x
|
2019-08-23 05:03:38 +08:00
|
|
|
new C().ok.toEqual(true)
|
2017-07-12 01:08:23 +08:00
|
|
|
x
|
2019-08-23 05:03:38 +08:00
|
|
|
new C2().ok.toEqual(true)
|
2017-07-12 01:08:23 +08:00
|
|
|
x
|
2019-08-23 05:03:38 +08:00
|
|
|
new New.C().ok.toEqual(true)
|
|
|
|
|
})
|