<commit_before>'use babel'

import ClangTidy from '../lib/clang-tidy'
import ClangTidyLinter from '../lib/clang-tidy-linter'

describe('ClangTidyLinter', () => {
  it('generate linter messages', () => {
    const clangTidy = new ClangTidy('./spec/bin/clang-tidy')
    const linter = new ClangTidyLinter(clangTidy, {
      getClangCppFlags: () => []
    })

    let result = null
    waitsForPromise(() => {
      return atom.workspace.open('foo.cpp').then(editor => {
        return linter.lint(editor)
      }).then(output => {
        result = output
        return output
      })
    })
    runs(() => {
      expect(result).not.toBe(null)
      expect(result.length).toBe(1)

      const message = result[0]
      expect(message.range.start.row).toBe(0)
      expect(message.range.start.column).toBe(0)
      expect(message.range.end.row).toBe(3)
      expect(message.range.end.column).toBe(13)
      expect(message.severity).toBe('warning')
      expect(message.text).toBe("unused function 'test' [clang-diagnostic-unused-function]")
      expect(message.trace.length).toBe(0)
    })
  })
})<commit_msg>Fix the test case<commit_after>'use babel'

import ClangTidy from '../lib/clang-tidy'
import ClangTidyLinter from '../lib/clang-tidy-linter'

describe('ClangTidyLinter', () => {
  it('generate linter messages', () => {
    const clangTidy = new ClangTidy('./spec/bin/clang-tidy')
    const linter = new ClangTidyLinter(clangTidy, {
      getClangCppFlags: () => []
    })

    let result = null
    waitsForPromise(() => {
      return atom.workspace.open('foo.cpp').then(editor => {
        return linter.lint(editor)
      }).then(output => {
        result = output
        return output
      })
    })
    runs(() => {
      expect(result).not.toBe(null)
      expect(result.length).toBe(1)

      const message = result[0]
      expect(message.range.start.row).toBe(0)
      expect(message.range.start.column).toBe(0)
      expect(message.range.end.row).toBe(2)
      expect(message.range.end.column).toBe(12)
      expect(message.severity).toBe('warning')
      expect(message.text).toBe("unused function 'test' [clang-diagnostic-unused-function]")
      expect(message.trace.length).toBe(0)
    })
  })
})
{'fraction_non_alphanumeric': 0.16561656165616562, 'fraction_numerical': 0.0072007200720072, 'mean_word_length': 2.9414893617021276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2989295', 'n_tokens_mistral': 746, 'n_tokens_neox': 743, 'n_words': 107}