Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Commit

Permalink
[test] Test laxcomma option
Browse files Browse the repository at this point in the history
Tests jshint#340.
  • Loading branch information
mmalecki committed Jan 9, 2012
1 parent accf3cb commit e10b6df
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/fixtures/laxcomma.js
@@ -0,0 +1,12 @@
var a = 1
, b = 2
, c = 3;

function func() {
var x, y
, z;

return x
&& z;
}

23 changes: 23 additions & 0 deletions tests/options.js
Expand Up @@ -894,3 +894,26 @@ exports.esnext = function () {
.addError(4, "Attempting to override 'foo' which is a constant")
.test(code, { esnext: true });
};

/*
* Tests the `laxcomma` option
*/
exports.laxcomma = function () {
var src = fs.readFileSync(__dirname + '/fixtures/laxcomma.js', 'utf8');

TestRun()
.addError(1, "Bad line breaking before ','.")
.addError(2, "Bad line breaking before ','.")
.addError(6, "Bad line breaking before ','.")
.addError(10, "Bad line breaking before '&&'.")
.test(src);

TestRun()
.addError(1, "Bad line breaking before ','.")
.addError(2, "Bad line breaking before ','.")
.addError(6, "Bad line breaking before ','.")
.test(src, { laxbreak: true });

TestRun().test(src, { laxbreak: true, laxcomma: true });
};

0 comments on commit e10b6df

Please sign in to comment.