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

describe('rules/require-blocks-on-newline', function() {
    var checker;
    beforeEach(function() {
        checker = new Checker();
        checker.registerDefaultRules();
    });
    it('should report missing newline after opening brace', function() {
        checker.configure({ requireBlocksOnNewline: true });
        assert(checker.checkString('if (true) {abc();\n}').getErrorCount() === 1);
    });
    it('should report missing newline before closing brace', function() {
        checker.configure({ requireBlocksOnNewline: true });
        assert(checker.checkString('if (true) {\nabc();}').getErrorCount() === 1);
    });
    it('should report missing newlines in both cases', function() {
        checker.configure({ requireBlocksOnNewline: true });
        assert(checker.checkString('if (true) {abc();}').getErrorCount() === 2);
    });
    it('should not report with no spaces', function() {
        checker.configure({ requireBlocksOnNewline: true });
        assert(checker.checkString('if (true) {\nabc();\n}').isEmpty());
    });
    it('should not report empty function definitions', function() {
        checker.configure({ requireBlocksOnNewline: true });
        assert(checker.checkString('var a = function() {};').isEmpty());
    });
});<commit_msg>Move checker.configure(...) line to beforeeach<commit_after>var Checker = require('../lib/checker');
var assert = require('assert');

describe('rules/require-blocks-on-newline', function() {
    var checker;
    beforeEach(function() {
        checker = new Checker();
        checker.registerDefaultRules();
        checker.configure({ requireBlocksOnNewline: true });
    });
    it('should report missing newline after opening brace', function() {
        assert(checker.checkString('if (true) {abc();\n}').getErrorCount() === 1);
    });
    it('should report missing newline before closing brace', function() {
        assert(checker.checkString('if (true) {\nabc();}').getErrorCount() === 1);
    });
    it('should report missing newlines in both cases', function() {
        assert(checker.checkString('if (true) {abc();}').getErrorCount() === 2);
    });
    it('should not report with no spaces', function() {
        assert(checker.checkString('if (true) {\nabc();\n}').isEmpty());
    });
    it('should not report empty function definitions', function() {
        assert(checker.checkString('var a = function() {};').isEmpty());
    });
});
{'fraction_non_alphanumeric': 0.17878426698450536, 'fraction_numerical': 0.0023837902264600714, 'mean_word_length': 3.7065420560747664, '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': '6525735', 'n_tokens_mistral': 705, 'n_tokens_neox': 696, 'n_words': 166}