Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Latest commit

 

History

History
53 lines (33 loc) · 1.48 KB

test_literate.litcoffee

File metadata and controls

53 lines (33 loc) · 1.48 KB

The post-test process involves linting all of the files under test/. By writing this file in Literate (style?) it verifies that literate files are automatically detected.

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

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

Markdown uses trailing spaces to force a line break.

    'Trailing whitespace in markdown':

        topic :

The line of code is written weird because I had trouble getting the 4 space prefix in place.

            """This is some `Markdown`.  \n\n
            \n    x = 1234  \n    y = 1
            """

        'is ignored': (source) ->

The 3rd parameter here indicates that the incoming source is literate.

            errors = coffeelint.lint(source, {}, true)

This intentionally includes trailing whitespace in code so it also verifies that the way Markdown spaces are stripped are not also stripping code.

            assert.equal(errors.length, 1)

    'Tab indented markdown':

        topic:

Second line in this topic is used to test support for a tab indented lines. Third line verifies that only a first tab is removed.

            """This is some `Markdown`.\n\n
            \n	x = 1\n				y = 1
            """

        'is ignored': (source) ->

            errors = coffeelint.lint(source, {}, true)
            assert.equal(errors.length, 3)

}).export(module)