Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.22 KB

code-lang.spec.coffee.md

File metadata and controls

38 lines (28 loc) · 1.22 KB

Test Pattern Language is Supported

RULE: The language of the code inside the test pattern block should be supported. The language of the testing pattern is defined by the fenced code block.

The convention I use when writting literate CoffeeScript is that code colorized as CoffeeScript is the actual code used to implement this rule, while example code does not have syntax highlighting.

Examples

    ```CoffeeScript
    ```
    ```JavaScript
    ```

This rule uses the isSupported and getCode functions from rule util.

    'use strict'
    util = require('../lib/rule.util')
    getCode = (lang) ->
        util.getCode "code-lang/#{lang}"

Define rule acceptance tests.

    describe 'the code block', ->
        it 'should be a supported code language', ->
            #validate based on language
            block = getCode 'javascript'
            expect(util.isSupported block.lang).toBe yes
            
            block = getCode 'coffeescript'
            expect(util.isSupported block.lang).toBe yes