<commit_before>assert = require 'power-assert'
bHtml = require './'

describe 'Comment (<!--)', ->
  it 'works', ->
    source = '''
      <!--xyz
    '''
    assert bHtml(source, format: 'demo') is '<!--xyz-->'

    source = '''
      <!--xyz
    '''
    assert bHtml(source) is '<!--xyz-->'

  context '(errors)', ->
    it 'works', ->
      f = ->
        bHtml '''
          <!--xyz
              <!--xyz
        '''
      assert.throws f, ({ columnNumber, lineNumber, message }) ->
        assert columnNumber is 5
        assert lineNumber is 2
        assert message is 'too deep indentation'
        true

      f = ->
        bHtml '''
          <!--xyz
            <!--xyz
        '''
      assert.throws f, ({ columnNumber, lineNumber, message }) ->
        assert columnNumber is 3
        assert lineNumber is 2
        assert message is 'comment must not have a child'
        true<commit_msg>add tests for comment format option<commit_after>assert = require 'power-assert'
bHtml = require './'

describe 'Comment (<!--)', ->
  context '1', ->
    it 'works', ->
      source = '''
        <!--xyz
      '''
      format = (nodes, options) ->
        assert nodes.length is 1
        assert nodes[0].type is 'comment'
        assert nodes[0].value is 'xyz'
        assert.deepEqual options, { format }
      bHtml source, { format }
      assert bHtml(source) is '<!--xyz-->'
      assert bHtml(source, format: 'demo') is '<!--xyz-->'

  context '(errors)', ->
    it 'works', ->
      f = ->
        bHtml '''
          <!--xyz
              <!--xyz
        '''
      assert.throws f, ({ columnNumber, lineNumber, message }) ->
        assert columnNumber is 5
        assert lineNumber is 2
        assert message is 'too deep indentation'
        true

      f = ->
        bHtml '''
          <!--xyz
            <!--xyz
        '''
      assert.throws f, ({ columnNumber, lineNumber, message }) ->
        assert columnNumber is 3
        assert lineNumber is 2
        assert message is 'comment must not have a child'
        true
{'fraction_non_alphanumeric': 0.15114578254509994, 'fraction_numerical': 0.005850804485616773, 'mean_word_length': 1.6106870229007633, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 25, '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': '4592639', 'n_tokens_mistral': 585, 'n_tokens_neox': 552, 'n_words': 181}