1 | var fs = require('fs')
|
2 | , clarinet = require('../clarinet.js')
|
3 | , parser = clarinet.CParser()
|
4 | , assert = require('assert')
|
5 | ;
|
6 |
|
7 | var json = '{"one": [{"fish": 1}]}';
|
8 |
|
9 | describe('clarinet', function(){
|
10 | describe('#position', function() {
|
11 | it('should be able to correctly track position', function (done){
|
12 | fs.readFile('test/sample.json', 'utf8', function (err,data) {
|
13 | if (err) {
|
14 | done(err);
|
15 | }
|
16 | parser.onend = function() {
|
17 | assert.equal(696, this.position);
|
18 | };
|
19 | parser.write(data);
|
20 | parser.close();
|
21 | done();
|
22 | });
|
23 | });
|
24 | });
|
25 | });
|