<commit_before>CodeContext = require '../lib/code-context'
grammarMap = require '../lib/grammars'

describe 'grammarMap', ->
  beforeEach ->
    @codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
    # TODO: Test using an actual editor or a selection?
    @dummyTextSource = {}
    @dummyTextSource.getText = -> ""

  it 'has a command and an args function set for each grammar\'s mode', ->
    @codeContext.textSource = @dummyTextSource
    for lang,modes of grammarMap
      for mode,commandContext of modes
        expect(commandContext.command).toBeDefined()
        argList = commandContext.args(@codeContext)
        expect(argList).toBeDefined()<commit_msg>Add basic C, C++, Objective-C, and Objective-C++ specs<commit_after>CodeContext = require '../lib/code-context'
grammarMap = require '../lib/grammars'

describe 'grammarMap', ->
  beforeEach ->
    @codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
    # TODO: Test using an actual editor or a selection?
    @dummyTextSource = {}
    @dummyTextSource.getText = -> ""

  it 'has a command and an args function set for each grammar\'s mode', ->
    @codeContext.textSource = @dummyTextSource
    for lang,modes of grammarMap
      for mode,commandContext of modes
        expect(commandContext.command).toBeDefined()
        argList = commandContext.args(@codeContext)
        expect(argList).toBeDefined()

  describe 'C', ->
    it 'returns the "xcrun" File Based runner on Mac OS X', ->
      grammar = grammarMap['C']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner.command).toEqual('xcrun')

    it 'is not defined on other operating systems', ->
      grammar = grammarMap['C']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner).toBe(undefined)

  describe 'C++', ->
    it 'returns the "xcrun" File Based runner on Mac OS X', ->
      grammar = grammarMap['C++']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner.command).toEqual('xcrun')

    it 'is not defined on other operating systems', ->
      grammar = grammarMap['C++']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner).toBe(undefined)

  describe 'Objective-C', ->
    it 'returns the "xcrun" File Based runner on Mac OS X', ->
      grammar = grammarMap['Objective-C']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner.command).toEqual('xcrun')

    it 'is not defined on other operating systems', ->
      grammar = grammarMap['Objective-C']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner).toBe(undefined)

  describe 'Objective-C++', ->
    it 'returns the "xcrun" File Based runner on Mac OS X', ->
      grammar = grammarMap['Objective-C++']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner.command).toEqual('xcrun')

    it 'is not defined on other operating systems', ->
      grammar = grammarMap['Objective-C++']
      fileBasedRunner = grammar['File Based']
      expect(fileBasedRunner).toBe(undefined)
{'fraction_non_alphanumeric': 0.12798690671031096, 'fraction_numerical': 0.0, 'mean_word_length': 3.428985507246377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1847355', 'n_tokens_mistral': 890, 'n_tokens_neox': 855, 'n_words': 242}