Skip to content

Commit e4b8833

Browse files
committed
improve code coverage
1 parent 3afe67d commit e4b8833

4 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ it("should find var declaration in control statements", function() {
7171

7272
require("fail");
7373
}());
74+
75+
(function() {
76+
with({ a: 1 }) {
77+
var require = f;
78+
}
79+
80+
require("fail");
81+
}());
7482
});
7583

7684
it("should find var declaration in control statements after usage", function() {
@@ -128,4 +136,14 @@ it("should find var declaration in control statements after usage", function() {
128136

129137
test();
130138
}());
139+
140+
(function() {
141+
var test = (function() { require("fail"); });
142+
143+
with({ a: 1 }) {
144+
var require = f;
145+
}
146+
147+
test();
148+
}());
131149
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use strict";
2+
3+
it("should find var declaration in control statements", function() {
4+
var f = (function(x) {
5+
x.should.be.eql("fail");
6+
});
7+
8+
(function() {
9+
for(let x of ["a"]) {
10+
var require = f;
11+
}
12+
13+
require("fail");
14+
}());
15+
});
16+
17+
it("should find var declaration in control statements after usage", function() {
18+
var f = (function(x) {
19+
x.should.be.eql("fail");
20+
});
21+
22+
(function() {
23+
var test = (function() { require("fail"); });
24+
25+
for(let x of ["a"]) {
26+
var require = f;
27+
}
28+
29+
test();
30+
}());
31+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var supportsForOf = require("../../../helpers/supportsForOf");
2+
3+
module.exports = function(config) {
4+
return !config.minimize && supportsForOf();
5+
};

‎test/helpers/supportsForOf.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = function supportDefaultAssignment() {
2+
try {
3+
var f = eval("(function f() { for(var x of ['ok', 'fail']) return x; })");
4+
return f() === "ok" ;
5+
} catch(e) {
6+
return false;
7+
}
8+
};

0 commit comments

Comments
 (0)