<commit_before>path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')

vows.describe('colonassignmentspacing').addBatch({

    'Spacing around assignment' :

        topic : ->
            '''
            object = {spacing : true}
            class Dog
              barks : true
            stringyObject =
              'stringkey' : 'ok'
            '''

        'will not return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

    'No spacing around assignment' :

        topic : ->
            '''
            object = {spacing: false}
            class Cat
              barks: false
            stringyObject =
              'stringkey': 'notcool'
            '''

        'will return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.equal(errors.length, 3)

        'will ignore an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'ignore'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

    'Should not complain about strings' :

        topic : ->
            '''
            foo = (stuff) ->
              throw new Error("Error: stuff required") unless stuff?
              # do real work
            '''

        'will return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

}).export(module)<commit_msg>add newline test<commit_after>path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')

vows.describe('colonassignmentspacing').addBatch({

    'Spacing around assignment' :

        topic : ->
            '''
            object = {spacing : true}
            class Dog
              barks : true
            stringyObject =
              'stringkey' : 'ok'
            newlineObject =
              obj :
                key : 'value'
            '''

        'will not return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

    'No spacing around assignment' :

        topic : ->
            '''
            object = {spacing: false}
            class Cat
              barks: false
            stringyObject =
              'stringkey': 'notcool'
            '''

        'will return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.equal(errors.length, 3)

        'will ignore an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'ignore'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

    'Should not complain about strings' :

        topic : ->
            '''
            foo = (stuff) ->
              throw new Error("Error: stuff required") unless stuff?
              # do real work
            '''

        'will return an error' : (source) ->
            config = 'colon_assignment_spacing' : {'level' : 'error'}
            errors = coffeelint.lint(source, config)
            assert.isEmpty(errors)

}).export(module)
{'fraction_non_alphanumeric': 0.12127125731809311, 'fraction_numerical': 0.0005575689991636465, 'mean_word_length': 1.6304985337243403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '7138337', 'n_tokens_mistral': 994, 'n_tokens_neox': 941, 'n_words': 239}