@@ -106,7 +106,7 @@ describe 'Option `columns`', ->
106106 4,5,6,x
107107 7,8,9,x
108108 """ , columns : [" a" , " b" , " c" , " d" ], (err , data ) ->
109- assert_error
109+ assert_error err,
110110 message : ' Invalid Record Length: header length is 4, got 3 on line 1'
111111 code : ' CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS'
112112 next ()
@@ -117,14 +117,26 @@ describe 'Option `columns`', ->
117117 4,5,6,x
118118 7,8,9
119119 """ , columns : [" a" , " b" , " c" , " d" ], (err , data ) ->
120- assert_error
120+ assert_error err,
121121 message : ' Invalid Record Length: header length is 4, got 3 on line 3'
122122 code : ' CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS'
123123 next ()
124+
125+ it ' context column is null when cast force the context creation' , (next ) ->
126+ # Trigger cast to force the creation of a context
127+ parse " a\n b,\n " ,
128+ columns : true
129+ cast : (value ) -> value
130+ , (err , data ) ->
131+ assert_error err,
132+ message : ' Invalid Record Length: header length is 1, got 2 on line 2'
133+ code : ' CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS'
134+ column : null
135+ next ()
124136
125- it ' null context column when columns number inferieur to record length, fix regression #259' , (next ) ->
137+ it ' context column is null when columns number inferieur to record length, fix regression #259' , (next ) ->
126138 parse " a\n b,\n " , columns : true , (err , data ) ->
127- assert_error
139+ assert_error err,
128140 message : ' Invalid Record Length: header length is 1, got 2 on line 2'
129141 code : ' CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS'
130142 column : null
0 commit comments