<commit_before>var Checker = require('../../lib/checker');
var assert = require('assert');

describe('rules/disallow-multiple-line-breaks', function() {
    var checker;

    beforeEach(function() {
        checker = new Checker();
        checker.registerDefaultRules();
        checker.configure({ disallowMultipleLineBreaks: true });
    });

    it('should report multiple line break', function() {
        assert(checker.checkString('x = 1;\n\n\ny = 2;').getErrorCount() === 1);
    });

    it('should not report single line break', function() {
        assert(checker.checkString('x = 1;\n\ny = 2').isEmpty());
    });

    it('should not report single line break when first line starts with #!', function() {
        assert(checker.checkString('#!/usr/bin/env node\nx = 1;').isEmpty());
        assert(checker.checkString('#!/usr/bin/env node\n\nx = 1;').isEmpty());
    });

    it('should report error in the correct location when first line starts with #!', function() {
        var error = checker.checkString('#!/usr/bin/env node\n\n\nx = 1;').getErrorList()[0];
        assert.equal(error.line, 2);
        assert.equal(error.column, 0);
    });

    it('should report only once per each sequence of line breaks', function() {
        assert(checker.checkString('x = 1;\n\n\n\n\ny = 2').getErrorCount() === 1);
    });

    it('should report multiple line break if CRLF is used', function() {<commit_msg>disallowMultipleLineBreaks: 100% code coverage<commit_after>var Checker = require('../../lib/checker');
var assert = require('assert');

describe('rules/disallow-multiple-line-breaks', function() {
    var checker;

    beforeEach(function() {
        checker = new Checker();
        checker.registerDefaultRules();
        checker.configure({ disallowMultipleLineBreaks: true });
    });

    it('should report multiple line break', function() {
        assert(checker.checkString('x = 1;\n\n\ny = 2;').getErrorCount() === 1);
    });

    it('should report multiple line break at EOF', function() {
        assert(checker.checkString('x = 1;\n\n\n').getErrorCount() === 1);
    });

    it('should not report single line break', function() {
        assert(checker.checkString('x = 1;\n\ny = 2').isEmpty());
    });

    it('should not report single line break when first line starts with #!', function() {
        assert(checker.checkString('#!/usr/bin/env node\nx = 1;').isEmpty());
        assert(checker.checkString('#!/usr/bin/env node\n\nx = 1;').isEmpty());
    });

    it('should report error in the correct location when first line starts with #!', function() {
        var error = checker.checkString('#!/usr/bin/env node\n\n\nx = 1;').getErrorList()[0];
        assert.equal(error.line, 2);
        assert.equal(error.column, 0);
    });

    it('should report only once per each sequence of line breaks', function() {
        assert(checker.checkString('x = 1;\n\n\n\n\ny = 2').getErrorCount() === 1);
    });

    it('should report multiple line break if CRLF is used', function() {
{'fraction_non_alphanumeric': 0.17533974146503148, 'fraction_numerical': 0.010938017898574744, 'mean_word_length': 3.1858529819694867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2356851', 'n_tokens_mistral': 937, 'n_tokens_neox': 884, 'n_words': 220}