Skip to content

Commit 458ac6a

Browse files
rubenwRubenVerborgh
authored andcommitted
Adde test with split unicode sequence.
1 parent fb05fc6 commit 458ac6a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/N3StreamParser-test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ describe('N3StreamParser', function () {
3131
it('should parse decimals that are split across chunks in the stream',
3232
shouldParse('<sub> <pred> 11.2 .'.match(/.{1,2}/g), 1));
3333

34+
it.skip('should parse non-breaking spaces that are split across chunks in the stream correctly', function (done) {
35+
var buffer = Buffer.from('<sub> <pred> " " .'),
36+
chunks = [buffer, buffer.slice(0, 15), buffer.slice(15, buffer.length)];
37+
shouldParse(chunks, 2, function (triples) {
38+
triples[0].should.deep.equal(triples[1]);
39+
})(done);
40+
});
41+
3442
it("doesn't parse an invalid stream",
3543
shouldNotParse(['z.'], 'Unexpected "z." on line 1.'), { token: undefined, line: 1, previousToken: undefined });
3644

@@ -51,7 +59,7 @@ describe('N3StreamParser', function () {
5159
});
5260

5361

54-
function shouldParse(chunks, expectedLength) {
62+
function shouldParse(chunks, expectedLength, validateTriples) {
5563
return function (done) {
5664
var triples = [],
5765
inputStream = new ArrayReader(chunks),
@@ -62,6 +70,7 @@ function shouldParse(chunks, expectedLength) {
6270
parser.on('error', done);
6371
parser.on('end', function () {
6472
triples.should.have.length(expectedLength);
73+
if (validateTriples) validateTriples(triples);
6574
done();
6675
});
6776
};

0 commit comments

Comments
 (0)