Skip to content

Instantly share code, notes, and snippets.

@markelog
Created August 26, 2014 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markelog/625fdec212b938b43738 to your computer and use it in GitHub Desktop.
Save markelog/625fdec212b938b43738 to your computer and use it in GitHub Desktop.
jscs, pull 562
it('should not require between simple arguments', function() {
assert(checker.checkString('foo(a,b);').getErrorCount() === 2);
assert(checker.checkString('foo( a,b);').getErrorCount() === 1);
assert(checker.checkString('foo( a,b );').isEmpty());
});
it('should not require spaces for empty arguments list', function() {
assert(checker.checkString('foo();').isEmpty());
});
it('should require spaces for grouping parentheses', function() {
assert(checker.checkString('var test = (true ? true : false)').getErrorCount() === 2);
assert(checker.checkString('var test = ( true ? true : false)').getErrorCount() === 1);
assert(checker.checkString('var test = ( true ? true : false )').isEmpty());
});
it('should require spaces for "for" keyword', function() {
assert(checker.checkString('for (var i = 0; i < 100; i++)').getErrorCount() === 2);
assert(checker.checkString('for ( var i = 0; i < 100; i++)').getErrorCount() === 1);
assert(checker.checkString('for ( var i = 0; i < 100; i++ )').isEmpty());
});
it('should require spaces for "while" keyword', function() {
assert(checker.checkString('while (!condition)').getErrorCount() === 2);
assert(checker.checkString('while ( !condition)').getErrorCount() === 1);
assert(checker.checkString('while ( !condition )').isEmpty());
});
it('should require spaces for "while" keyword', function() {
assert(checker.checkString('while (!condition)').getErrorCount() === 2);
assert(checker.checkString('while ( !condition)').getErrorCount() === 1);
assert(checker.checkString('while ( !condition )').isEmpty());
});
it('should require spaces for "try...catch" statement', function() {
assert(checker.checkString('try {} catch(e)').getErrorCount() === 2);
assert(checker.checkString('try {} catch( e)').getErrorCount() === 1);
assert(checker.checkString('try {} catch( e )').isEmpty());
});
@mikesherov
Copy link

The it on line 1 should say should instead of should not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment