csv test data for writing robust csv parsers
npm install csv-spectrum
A bunch of different CSV files to serve as an acid test for CSV parsing libraries. There are also JSON versions of the CSVs for verification purposes.
The goal of this repository is to capture test cases to represent the entire CSV spectrum.
Please use these in your test suites and send contributions in the form of more/improved test cases.
It is also a node module that you can require() in your tests
Some CSVs here were included from csvkit
https://github.com/maxogden/binary-csv uses csv-spectrum and passes all tests
``js`
vsr spectrum = require('csv-spectrum')
spectrum(function(err, data) {
// data is an array of objects has all the csv and json versions of the tests
})
data looks like this:
``
[ { csv:
json:
name: 'comma_in_quotes' },
{ csv:
json:
name: 'escaped_quotes' }
// etc
]
example usage in a test might be:
```
vsr spectrum = require('csv-spectrum')
spectrum(function(err, data) {
console.log('testing ' + data[0].name)
t.equal(csv2json(data[0].csv), JSON.parse(data[0].json))
})