UNPKG

1.18 kBtext/coffeescriptView Raw
1fs = require 'fs'
2os = require 'os'
3path = require 'path'
4events = require "events"
5
6vows = require "vows"
7assert = require "assert"
8
9{FsUtil} = (require "#{__dirname}/../lib/toaster").toaster.utils
10{spawn_toaster,snapshot} = require "#{__dirname}/utils/utils"
11
12error_message = "ERROR Parse error on line 12: Unexpected 'UNARY' at file: "
13error_message += if os.platform() is "win32" then "\\" else "/"
14error_message += "app.coffee"
15
16vows.describe( 'Error with line number' )
17.addBatch( 'Compiling a project':
18 'that has syntax error on file "app.js" at line 12':
19 topic:->
20 report_msg = null
21 folder = path.resolve "#{__dirname}/_templates/error_with_line_number"
22 toaster = spawn_toaster ['-c', folder]
23
24 toaster.stdout.on 'data', (data)->
25 unless report_msg?
26 report_msg = data.toString().stripColors.replace /\n/g, ""
27
28 toaster.stderr.on 'data', ( error )=>
29 @callback error.toString()
30
31 toaster.on 'exit', (data)=>
32 @callback null, report_msg
33
34 undefined
35
36 'should rise the error precisely':( err, reported_msg )->
37 assert.equal err, null
38 assert.equal reported_msg, error_message
39).export module
\No newline at end of file