@@ -14,6 +14,9 @@ describe('rules/require-multiple-var-decl', function() {
1414 checker . registerDefaultRules ( ) ;
1515 checker . configure ( { requireMultipleVarDecl : true } ) ;
1616 } ) ;
17+ it ( 'should not report const and var decls as one entity (#462)' , function ( ) {
18+ assert ( checker . checkString ( 'const a = 1; var b = 2;' ) . isEmpty ( ) ) ;
19+ } ) ;
1720 it ( 'should report consecutive var decl' , function ( ) {
1821 assert ( checker . checkString ( 'var x; var y;' ) . getErrorCount ( ) === 1 ) ;
1922 } ) ;
@@ -32,6 +35,9 @@ describe('rules/require-multiple-var-decl', function() {
3235 checker . configure ( { requireMultipleVarDecl : 'onevar' } ) ;
3336 } ) ;
3437
38+ it ( 'should not report const and var decls as one entity (#462)' , function ( ) {
39+ assert ( checker . checkString ( 'const a = 1; var b = 2;' ) . isEmpty ( ) ) ;
40+ } ) ;
3541 it ( 'should report consecutive var decl' , function ( ) {
3642 assert ( checker . checkString ( 'var x; var y;' ) . getErrorCount ( ) === 1 ) ;
3743 } ) ;
@@ -51,6 +57,30 @@ describe('rules/require-multiple-var-decl', function() {
5157 }
5258 assert ( checker . checkString ( test . toString ( ) ) . getErrorCount ( ) === 1 ) ;
5359 } ) ;
60+ it ( 'should report multiple const in function' , function ( ) {
61+ /* jshint esnext: true */
62+ function test ( ) {
63+ const first = true ;
64+
65+ if ( true ) {
66+ const second = 2 ;
67+ }
68+ }
69+ assert ( checker . checkString ( test . toString ( ) ) . getErrorCount ( ) === 1 ) ;
70+ } ) ;
71+ it ( 'should report multiple const and vars in function' , function ( ) {
72+ /* jshint esnext: true */
73+ function test ( ) {
74+ const firstConst = true ;
75+ var firstVar = true ;
76+
77+ if ( true ) {
78+ const secondConst = 2 ;
79+ var secondVar = 2 ;
80+ }
81+ }
82+ assert ( checker . checkString ( test . toString ( ) ) . getErrorCount ( ) === 2 ) ;
83+ } ) ;
5484 it ( 'should not confuse two separate functions' , function ( ) {
5585 function testFunc ( ) {
5686 function foo ( ) {
0 commit comments