From 20ba9fbf63032d6875c39208dccc35ab16da9614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Fennibay?= Date: Thu, 17 Jul 2025 15:31:59 +0200 Subject: [PATCH 1/2] add tests for the dotted IRI/prefixedname --- tests/unit/parse-test.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/unit/parse-test.js b/tests/unit/parse-test.js index 2492d4702..4e7032fdc 100644 --- a/tests/unit/parse-test.js +++ b/tests/unit/parse-test.js @@ -214,6 +214,36 @@ ex:myid ex:prop1 [ ex:prop2 [ ex:prop3 "value" ] ]. expect(serialize(store.sym(base), store, null, 'application/ld+json')).to.eql(body('def')) }); }) + describe("ttl with special characters", () => { + it('parses an IRI with a dot', () => { + const base = 'https://example.org/test.ttl' + const mimeType = 'text/turtle' + const store = DataFactory.graph() + const content = ` + . + ` + parse(content, store, base, mimeType) + expect(store.statements).to.have.length(1) + expect(store.statements[0].subject.value).to.equal('http://example.org/ns#subj.ect') + expect(store.statements[0].predicate.value).to.equal('http://example.org/ns#predi.cate') + expect(store.statements[0].object.value).to.equal('http://example.org/ns#object') + }) + + it('parses a prefixed name with a dot', () => { + const base = 'https://example.org/test.ttl' + const mimeType = 'text/turtle' + const store = DataFactory.graph() + const content = ` + @prefix ex: . + ex:subj.ect ex:predi.cate ex:obj.ect . + ` + parse(content, store, base, mimeType) + expect(store.statements).to.have.length(1) + expect(store.statements[0].subject.value).to.equal('http://example.org/ns#subj.ect') + expect(store.statements[0].predicate.value).to.equal('http://example.org/ns#predi.cate') + expect(store.statements[0].object.value).to.equal('http://example.org/ns#obj.ect') + }) + }) }) }) // ttl From 9617f73e31983a26db0baeefd2b83d7a6e86aba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Fennibay?= Date: Thu, 17 Jul 2025 15:51:02 +0200 Subject: [PATCH 2/2] use dot also in the object --- tests/unit/parse-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/parse-test.js b/tests/unit/parse-test.js index 4e7032fdc..d43311171 100644 --- a/tests/unit/parse-test.js +++ b/tests/unit/parse-test.js @@ -220,13 +220,13 @@ ex:myid ex:prop1 [ ex:prop2 [ ex:prop3 "value" ] ]. const mimeType = 'text/turtle' const store = DataFactory.graph() const content = ` - . + . ` parse(content, store, base, mimeType) expect(store.statements).to.have.length(1) expect(store.statements[0].subject.value).to.equal('http://example.org/ns#subj.ect') expect(store.statements[0].predicate.value).to.equal('http://example.org/ns#predi.cate') - expect(store.statements[0].object.value).to.equal('http://example.org/ns#object') + expect(store.statements[0].object.value).to.equal('http://example.org/ns#obj.ect') }) it('parses a prefixed name with a dot', () => {