 
       describe 'Tables at the end of document', ->
         modTest = testFormat editorFormat, (text, rand) ->
-          nonTables[Math.floor(rand * nonTables.length)] + '\n' + text
+          modCrLf nonTables[Math.floor(rand * nonTables.length)] + opts.crlf + text
         testSuite modTest
 
       describe 'Tables at the beginning of document', ->
         modTest = testFormat editorFormat, (text, rand) ->
-          text + '\n' + nonTables[Math.floor(rand * nonTables.length)]
+          modCrLf text + opts.crlf + nonTables[Math.floor(rand * nonTables.length)]
         testSuite modTest
 
       it 'should properly format large text', ->

  runEditorTests = (grammar, fixture, scope, opts = {}) ->
    opts.addGrammar ?= true
    opts.selectBeforeTest ?= false

    describe "editor tests for #{grammar}", ->
      editor = null

      test = testFormat editorFormat = (input) ->
        editor.setText input
        if opts.selectBeforeTest
          editor.setSelectedBufferRange(editor.getBuffer().getRange())
        atom.commands.dispatch atom.views.getView(editor), 'markdown-table-formatter:format'
        editor.getText()

      beforeEach ->
        grammarPromise = atom.packages.activatePackage(grammar)

        expected = ''
        for table in testTables
          text = nonTables[Math.floor(Math.random() * nonTables.length)]
          edtext += opts.crlf + text + opts.crlf + table.test
          expected += opts.crlf + text + opts.crlf + table.expected
        test edtext, expected

  runEditorTests 'language-gfm', 'empty.md', 'source.gfm'
  runEditorTests 'language-text', 'empty.text', 'text.plain.null-grammar'
  runEditorTests 'language-gfm', 'empty.md', 'source.gfm',
    crlf: '\r\n'
  runEditorTests 'language-text', 'empty.text', 'text.plain.null-grammar',
    crlf: '\r\n'
  runEditorTests 'language-text', 'empty.text', 'text.plain.null-grammar',
    addGrammar: false
    selectBeforeTest: true
