Skip to content

Commit

Permalink
improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Apr 13, 2017
1 parent 3afe67d commit e4b8833
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ it("should find var declaration in control statements", function() {

require("fail");
}());

(function() {
with({ a: 1 }) {
var require = f;
}

require("fail");
}());
});

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

test();
}());

(function() {
var test = (function() { require("fail"); });

with({ a: 1 }) {
var require = f;
}

test();
}());
});
31 changes: 31 additions & 0 deletions test/cases/parsing/issue-4608-2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use strict";

it("should find var declaration in control statements", function() {
var f = (function(x) {
x.should.be.eql("fail");
});

(function() {
for(let x of ["a"]) {
var require = f;
}

require("fail");
}());
});

it("should find var declaration in control statements after usage", function() {
var f = (function(x) {
x.should.be.eql("fail");
});

(function() {
var test = (function() { require("fail"); });

for(let x of ["a"]) {
var require = f;
}

test();
}());
});
5 changes: 5 additions & 0 deletions test/cases/parsing/issue-4608-2/test.filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var supportsForOf = require("../../../helpers/supportsForOf");

module.exports = function(config) {
return !config.minimize && supportsForOf();
};
8 changes: 8 additions & 0 deletions test/helpers/supportsForOf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = function supportDefaultAssignment() {
try {
var f = eval("(function f() { for(var x of ['ok', 'fail']) return x; })");
return f() === "ok" ;
} catch(e) {
return false;
}
};

0 comments on commit e4b8833

Please sign in to comment.