This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
comment_lines: count the number of commented lines with no records
- Loading branch information
Showing
7 changed files
with
96 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
parse = require '../lib' | ||
|
||
describe 'properties comment_lines', -> | ||
|
||
it 'no empty lines', (next) -> | ||
parse ''' | ||
a,b,c | ||
d,e,f | ||
''', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 0 unless err | ||
next err | ||
|
||
it 'comment in the middle of a line', (next) -> | ||
parse ''' | ||
a,b,c | ||
d,e,f # comment | ||
h,i,j | ||
''', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 0 unless err | ||
next err | ||
|
||
it 'single comment line', (next) -> | ||
parse '# comment', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 1 unless err | ||
next err | ||
|
||
it 'single comment line with empty field', (next) -> | ||
parse '""# comment', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 0 unless err | ||
next err | ||
|
||
it 'two line in the middle of dataset', (next) -> | ||
parse ''' | ||
a,b,c | ||
# comment 1 | ||
# comment 2 | ||
d,e,f | ||
''', comment: '#', skip_empty_lines: true, (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 2 unless err | ||
next err | ||
|
||
it 'one line at the end of dataset', (next) -> | ||
parse ''' | ||
a,b,c | ||
d,e,f | ||
# comment | ||
''', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 1 unless err | ||
next err | ||
|
||
it 'one line a the begining', (next) -> | ||
parse ''' | ||
# comment | ||
a,b,c | ||
d,e,f | ||
''', comment: '#', (err, data, {comment_lines}) -> | ||
comment_lines.should.eql 1 unless err | ||
next err |