Skip to content

Commit 49b9f57

Browse files
Merge pull request #155 from rubensworks/feature/rdf-test-suite
Use rdf-test-suite for spec testing
2 parents 7b78b04 + be00c27 commit 49b9f57

File tree

14 files changed

+395
-403
lines changed

14 files changed

+395
-403
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
docs
44
browser/n3*
55
node_modules
6-
spec/*/*
6+
spec/*.ttl
77
coverage
8+
.rdf-test-suite-cache

.travis.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,13 @@ node_js:
66
- "node"
77
env:
88
- DEFAULT_NODE_VERSION=10
9-
addons:
10-
apt:
11-
sources:
12-
- boost-latest
13-
packages:
14-
# for SWObjects
15-
- libboost-all-dev
16-
- uuid-dev
17-
before_script:
18-
- | # Build SWObjects for spec tests
19-
if [ ! -e swobjects/bin/sparql ]; then
20-
rm -rf swobjects
21-
git clone https://github.com/ericprud/SWObjects.git swobjects
22-
pushd swobjects
23-
git checkout 1739b95536d2b7bf516f5543a6cf7e5c46a9a4f9
24-
sed -i 's/^SQL_CLIENTS=.*/SQL_CLIENTS= MYSQL /' CONFIG
25-
sed -i 's/^CRYPTLIB=.*/LDFLAGS += -lltdl -ldl/' CONFIG
26-
make -j2 bin/sparql
27-
popd
28-
fi
29-
- PATH=$PATH:swobjects/bin
30-
- sparql -v
319
script:
3210
- npm run lint
3311
- npm test
34-
- npm run spec
12+
- npm run spec-turtle
13+
- npm run spec-ntriples
14+
- npm run spec-nquads
15+
- npm run spec-trig
3516
- npm run docs
3617
after_success:
3718
- if [ "$TRAVIS_NODE_VERSION" == "$DEFAULT_NODE_VERSION" ]; then
@@ -41,10 +22,7 @@ after_success:
4122
./.travis_build_pages;
4223
fi
4324
cache:
44-
apt: true
4525
directories:
4626
- node_modules
47-
- swobjects
48-
- spec/turtle
49-
- spec/trig
27+
- .rdf-test-suite-cache
5028
sudo: false

lib/N3Lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function N3Lexer(options) {
2626
// In line mode (N-Triples or N-Quads), only simple features may be parsed
2727
if (options.lineMode) {
2828
// Don't tokenize special literals
29-
this._tripleQuotedString = this._number = this._boolean = /$0^/;
29+
this._tripleApos = this._tripleQuote = this._number = this._boolean = /$0^/;
3030
// Swap the tokenize method for a restricted version
3131
var self = this;
3232
this._tokenize = this.tokenize;

lib/N3Parser.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,15 @@ N3Parser.prototype = {
358358

359359
// ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node
360360
_readPredicateAfterBlank: function (token) {
361-
// If a dot follows a blank node in top context, there is no predicate
362-
if (token.type === '.' && !this._contextStack.length) {
363-
this._subject = null; // cancel the current quad
361+
switch (token.type) {
362+
case '.':
363+
case '}':
364+
// No predicate is coming if the triple is terminated here
365+
this._subject = null;
364366
return this._readPunctuation(token);
367+
default:
368+
return this._readPredicate(token);
365369
}
366-
return this._readPredicate(token);
367370
},
368371

369372
// ### `_readListItem` reads items from a list

0 commit comments

Comments
 (0)