Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/unit/parse-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<http://example.org/ns#subj.ect> <http://example.org/ns#predi.cate> <http://example.org/ns#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')
})

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: <http://example.org/ns#> .
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

Expand Down
Loading