1 | fs = require 'fs'
|
2 | os = require 'os'
|
3 | path = require 'path'
|
4 | events = require "events"
|
5 |
|
6 | vows = require "vows"
|
7 | assert = require "assert"
|
8 |
|
9 | {FsUtil} = (require "#{__dirname}/../lib/toaster").toaster.utils
|
10 | {spawn_toaster,snapshot} = require "#{__dirname}/utils/utils"
|
11 |
|
12 | error_message = "ERROR Parse error on line 12: Unexpected 'UNARY' at file: "
|
13 | error_message += if os.platform() is "win32" then "\\" else "/"
|
14 | error_message += "app.coffee"
|
15 |
|
16 | vows.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 |