Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
quote: reorganize error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed May 5, 2018
1 parent 3a03b4b commit 76fcdb4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions test/options.quote.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,33 @@ describe 'disabled', ->
data.should.eql [['a','b','c'],['1','r"2"d"2"','3']] unless err
next err

describe 'error', ->
describe 'error "Quoted field not terminated"', ->

it 'when unclosed', (next) ->
parse """
"",1974,8.8392926E7,"","
""", (err, data) ->
err.message.should.eql 'Quoted field not terminated at line 1'
next()


describe 'error "Invalid closing quote"', ->

it 'when invalid quotes', (next) ->
parse """
"" 1974 8.8392926E7 ""t ""
"" 1974 8.8392926E7 "" ""
""", quote: '"', escape: '"', delimiter: "\t", (err) ->
err.message.should.eql 'Invalid closing quote at line 1; found " " instead of delimiter "\\t"'
next()

it '"invalid opening quotes" count empty lines', (next) ->

it '"Invalid closing quote" display expected delimiter', (next) ->
parse '"",1974,8.8392926E7,""t,""', quote: '"', escape: '"', (err) ->
err.message.should.eql 'Invalid closing quote at line 1; found "t" instead of delimiter ","'
next()

describe 'error "Invalid opening quotes"', ->

it 'count empty lines', (next) ->
parse """
"this","line","is",valid
Expand All @@ -125,8 +134,3 @@ describe 'error', ->
(data == undefined).should.be.true
next()

it '"Invalid closing quote" display expected delimiter', (next) ->
parse '"",1974,8.8392926E7,""t,""', quote: '"', escape: '"', (err) ->
err.message.should.eql 'Invalid closing quote at line 1; found "t" instead of delimiter ","'
next()

0 comments on commit 76fcdb4

Please sign in to comment.