Permalink
Browse files

Test case for wildcard globals

  • Loading branch information...
1 parent f03f4f2 commit 15c6f0976ad7cae5c4abd0ebd25d3288f5c0a3a8 @valueof valueof committed Apr 10, 2011
Showing with 20 additions and 0 deletions.
  1. +13 −0 tests/core.js
  2. +7 −0 tests/fixtures/wildcardGlobals.js
View
@@ -106,4 +106,17 @@ exports.switchFallThrough = function () {
assert.eql(JSHINT.errors[0].reason, "Expected a 'break' statement before 'case'.");
assert.eql(JSHINT.errors[1].line, 18);
assert.eql(JSHINT.errors[1].reason, "Expected a 'break' statement before 'default'.");
+};
+
+exports.wildcardGlobals = function () {
+ var src = fs.readFileSync(__dirname + '/fixtures/wildcardGlobals.js', 'utf8');
+ JSHINT(src);
+ console.log(JSHINT.errors);
+ assert.ok(JSHINT(src));
+
+ var report = JSHINT.data();
+ assert.eql(report.implieds.length, 1);
+ assert.eql(report.implieds[0], 'awkwardFour');
+ assert.eql(report.globals.length, 1);
+ assert.eql(report.globals[0], 'test*');
};
@@ -0,0 +1,7 @@
+/*jshint undef:true */
+/*global test*:true */
+
+testOne();
+testTwo();
+testThree();
+awkwardfour();

0 comments on commit 15c6f09

Please sign in to comment.