Skip to content

Commit 8ce8428

Browse files
committed
fix: use describe for all shouldParse test suites
1 parent bec8395 commit 8ce8428

1 file changed

Lines changed: 34 additions & 35 deletions

File tree

test/N3Parser-test.js

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('Parser', () => {
6464
shouldParse('<a> <b> "string"@en.',
6565
['a', 'b', '"string"@en']));
6666

67-
it('should normalize language codes to lowercase',
67+
describe('should normalize language codes to lowercase',
6868
shouldParse('<a> <b> "string"@EN.',
6969
['a', 'b', '"string"@en']));
7070

@@ -76,7 +76,7 @@ describe('Parser', () => {
7676
shouldParse('@prefix x: <urn:x:y#>. <a> <b> "string"^^x:z.',
7777
['a', 'b', '"string"^^urn:x:y#z']));
7878

79-
it('should differentiate between IRI and prefixed name types',
79+
describe('should differentiate between IRI and prefixed name types',
8080
shouldParse('@prefix : <noturn:>. :a :b "x"^^<urn:foo>. :a :b "x"^^:urn:foo.',
8181
['noturn:a', 'noturn:b', '"x"^^urn:foo'],
8282
['noturn:a', 'noturn:b', '"x"^^noturn:urn:foo']));
@@ -369,7 +369,7 @@ describe('Parser', () => {
369369
['_:b0', 'c', '_:b1'],
370370
['_:b1', 'd', 'e']));
371371

372-
it('should reuse identifiers of blank nodes within and outside of graphs',
372+
describe('should reuse identifiers of blank nodes within and outside of graphs',
373373
shouldParse('_:a <b> _:c. <g> { _:a <b> _:c }',
374374
['_:b0_a', 'b', '_:b0_c'],
375375
['_:b0_a', 'b', '_:b0_c', 'g']));
@@ -477,7 +477,7 @@ describe('Parser', () => {
477477
['_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil']));
478478

479479
describe('should parse a nested list',
480-
shouldParse('<a> <b> ( ( <c> ) ).',
480+
shouldParse('<a> <b> ( ( <c> ) ).',
481481
['a', 'b', '_:b0'],
482482
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', '_:b1'],
483483
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'],
@@ -667,7 +667,7 @@ describe('Parser', () => {
667667
shouldNotParse('<a> <b> (]).',
668668
'Expected entity but got ] on line 1.'));
669669

670-
it('should resolve IRIs against @base',
670+
describe('should resolve IRIs against @base',
671671
shouldParse('@base <http://ex.org/>.\n' +
672672
'<a> <b> <c>.\n' +
673673
'@base <d/>.\n' +
@@ -679,23 +679,23 @@ describe('Parser', () => {
679679
shouldNotParse('@BASE <http://ex.org/>.',
680680
'Expected entity but got @BASE on line 1.'));
681681

682-
it('should resolve IRIs against SPARQL base',
682+
describe('should resolve IRIs against SPARQL base',
683683
shouldParse('BASE <http://ex.org/>\n' +
684684
'<a> <b> <c>. ' +
685685
'BASE <d/> ' +
686686
'<e> <f> <g>.',
687687
['http://ex.org/a', 'http://ex.org/b', 'http://ex.org/c'],
688688
['http://ex.org/d/e', 'http://ex.org/d/f', 'http://ex.org/d/g']));
689689

690-
it('should resolve IRIs against a @base with query string',
690+
describe('should resolve IRIs against a @base with query string',
691691
shouldParse('@base <http://ex.org/?foo>.\n' +
692692
'<> <b> <c>.\n' +
693693
'@base <d/?bar>.\n' +
694694
'<> <f> <g>.',
695695
['http://ex.org/?foo', 'http://ex.org/b', 'http://ex.org/c'],
696696
['http://ex.org/d/?bar', 'http://ex.org/d/f', 'http://ex.org/d/g']));
697697

698-
it('should resolve IRIs with query string against @base',
698+
describe('should resolve IRIs with query string against @base',
699699
shouldParse('@base <http://ex.org/>.\n' +
700700
'<?> <?a> <?a=b>.\n' +
701701
'@base <d>.\n' +
@@ -706,7 +706,7 @@ describe('Parser', () => {
706706
['http://ex.org/d?', 'http://ex.org/d?a', 'http://ex.org/d?a=b'],
707707
['http://ex.org/d?e', 'http://ex.org/d?a', 'http://ex.org/d?a=b']));
708708

709-
it('should not resolve IRIs with colons',
709+
describe('should not resolve IRIs with colons',
710710
shouldParse('@base <http://ex.org/>.\n' +
711711
'<a> <b> <c>.\n' +
712712
'<A:> <b:> <c:>.\n' +
@@ -723,25 +723,25 @@ describe('Parser', () => {
723723
shouldNotParse('@base <entity.beeldbank_leiden_person:A.E._Stuur.> .',
724724
'Expected valid IRI to follow base declaration on line 1.'));
725725

726-
it('should resolve datatype IRIs against @base',
726+
describe('should resolve datatype IRIs against @base',
727727
shouldParse('@base <http://ex.org/>.\n' +
728728
'<a> <b> "c"^^<d>.\n' +
729729
'@base <d/>.\n' +
730730
'<e> <f> "g"^^<h>.',
731731
['http://ex.org/a', 'http://ex.org/b', '"c"^^http://ex.org/d'],
732732
['http://ex.org/d/e', 'http://ex.org/d/f', '"g"^^http://ex.org/d/h']));
733733

734-
it('should resolve IRIs against a base with a fragment',
734+
describe('should resolve IRIs against a base with a fragment',
735735
shouldParse('@base <http://ex.org/foo#bar>.\n' +
736736
'<a> <b> <#c>.\n',
737737
['http://ex.org/a', 'http://ex.org/b', 'http://ex.org/foo#c']));
738738

739-
it('should resolve IRIs with an empty fragment',
739+
describe('should resolve IRIs with an empty fragment',
740740
shouldParse('@base <http://ex.org/foo>.\n' +
741741
'<#> <b#> <#c>.\n',
742742
['http://ex.org/foo#', 'http://ex.org/b#', 'http://ex.org/foo#c']));
743743

744-
it('should not resolve prefixed names',
744+
describe('should not resolve prefixed names',
745745
shouldParse('PREFIX ex: <http://ex.org/a/bb/ccc/../>\n' +
746746
'ex:a ex:b ex:c .',
747747
['http://ex.org/a/bb/ccc/../a', 'http://ex.org/a/bb/ccc/../b', 'http://ex.org/a/bb/ccc/../c']));
@@ -1243,7 +1243,7 @@ describe('Parser', () => {
12431243
[['a', 'b', 'c'], 'b', 'c'],
12441244
[['a', 'b', 'c'], 'd', ['a', 'b', 'c']]));
12451245

1246-
it('should put nested triples in the default graph',
1246+
describe('should put nested triples in the default graph',
12471247
shouldParse('<a> <b> <c> <g>.\n<<<a> <b> <c>>> <d> <e>.',
12481248
['a', 'b', 'c', 'g'],
12491249
[['a', 'b', 'c'], 'd', 'e']));
@@ -1339,15 +1339,15 @@ describe('Parser', () => {
13391339
describe('An Parser instance without document IRI', () => {
13401340
function parser() { return new Parser(); }
13411341

1342-
it('should keep relative IRIs',
1342+
describe('should keep relative IRIs',
13431343
shouldParse(parser,
13441344
'@prefix : <#>.\n' +
13451345
'<a> <b> <c> <g>.\n' +
13461346
':d :e :f :g.',
13471347
[termFromId('a'), termFromId('b'), termFromId('c'), termFromId('g')],
13481348
[termFromId('#d'), termFromId('#e'), termFromId('#f'), termFromId('#g')]));
13491349

1350-
it('should keep empty IRIs',
1350+
describe('should keep empty IRIs',
13511351
shouldParse(parser,
13521352
'@prefix : <>.\n' +
13531353
'<> <> <> <>.\n' +
@@ -1359,55 +1359,55 @@ describe('Parser', () => {
13591359
describe('An Parser instance with a document IRI', () => {
13601360
function parser() { return new Parser({ baseIRI: 'http://ex.org/x/yy/zzz/f.ttl' }); }
13611361

1362-
it('should resolve IRIs against the document IRI',
1362+
describe('should resolve IRIs against the document IRI',
13631363
shouldParse(parser,
13641364
'@prefix : <#>.\n' +
13651365
'<a> <b> <c> <g>.\n' +
13661366
':d :e :f :g.',
13671367
['http://ex.org/x/yy/zzz/a', 'http://ex.org/x/yy/zzz/b', 'http://ex.org/x/yy/zzz/c', 'http://ex.org/x/yy/zzz/g'],
13681368
['http://ex.org/x/yy/zzz/f.ttl#d', 'http://ex.org/x/yy/zzz/f.ttl#e', 'http://ex.org/x/yy/zzz/f.ttl#f', 'http://ex.org/x/yy/zzz/f.ttl#g']));
13691369

1370-
it('should resolve IRIs with a trailing slash against the document IRI',
1370+
describe('should resolve IRIs with a trailing slash against the document IRI',
13711371
shouldParse(parser,
13721372
'</a> </a/b> </a/b/c>.\n',
13731373
['http://ex.org/a', 'http://ex.org/a/b', 'http://ex.org/a/b/c']));
13741374

1375-
it('should resolve IRIs starting with ./ against the document IRI',
1375+
describe('should resolve IRIs starting with ./ against the document IRI',
13761376
shouldParse(parser,
13771377
'<./a> <./a/b> <./a/b/c>.\n',
13781378
['http://ex.org/x/yy/zzz/a', 'http://ex.org/x/yy/zzz/a/b', 'http://ex.org/x/yy/zzz/a/b/c']));
13791379

1380-
it('should resolve IRIs starting with multiple ./ sequences against the document IRI',
1380+
describe('should resolve IRIs starting with multiple ./ sequences against the document IRI',
13811381
shouldParse(parser,
13821382
'<./././a> <./././././a/b> <././././././a/b/c>.\n',
13831383
['http://ex.org/x/yy/zzz/a', 'http://ex.org/x/yy/zzz/a/b', 'http://ex.org/x/yy/zzz/a/b/c']));
13841384

1385-
it('should resolve IRIs starting with ../ against the document IRI',
1385+
describe('should resolve IRIs starting with ../ against the document IRI',
13861386
shouldParse(parser,
13871387
'<../a> <../a/b> <../a/b/c>.\n',
13881388
['http://ex.org/x/yy/a', 'http://ex.org/x/yy/a/b', 'http://ex.org/x/yy/a/b/c']));
13891389

1390-
it('should resolve IRIs starting multiple ../ sequences against the document IRI',
1390+
describe('should resolve IRIs starting multiple ../ sequences against the document IRI',
13911391
shouldParse(parser,
13921392
'<../../a> <../../../a/b> <../../../../../../../../a/b/c>.\n',
13931393
['http://ex.org/x/a', 'http://ex.org/a/b', 'http://ex.org/a/b/c']));
13941394

1395-
it('should resolve IRIs starting with mixes of ./ and ../ sequences against the document IRI',
1395+
describe('should resolve IRIs starting with mixes of ./ and ../ sequences against the document IRI',
13961396
shouldParse(parser,
13971397
'<.././a> <./.././a/b> <./.././.././a/b/c>.\n',
13981398
['http://ex.org/x/yy/a', 'http://ex.org/x/yy/a/b', 'http://ex.org/x/a/b/c']));
13991399

1400-
it('should resolve IRIs starting with .x, ..x, or .../ against the document IRI',
1400+
describe('should resolve IRIs starting with .x, ..x, or .../ against the document IRI',
14011401
shouldParse(parser,
14021402
'<.x/a> <..x/a/b> <.../a/b/c>.\n',
14031403
['http://ex.org/x/yy/zzz/.x/a', 'http://ex.org/x/yy/zzz/..x/a/b', 'http://ex.org/x/yy/zzz/.../a/b/c']));
14041404

1405-
it('should resolve datatype IRIs against the document IRI',
1405+
describe('should resolve datatype IRIs against the document IRI',
14061406
shouldParse(parser,
14071407
'<a> <b> "c"^^<d>.',
14081408
['http://ex.org/x/yy/zzz/a', 'http://ex.org/x/yy/zzz/b', '"c"^^http://ex.org/x/yy/zzz/d']));
14091409

1410-
it('should resolve IRIs in lists against the document IRI',
1410+
describe('should resolve IRIs in lists against the document IRI',
14111411
shouldParse(parser,
14121412
'(<a> <b>) <p> (<c> <d>).',
14131413
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://ex.org/x/yy/zzz/a'],
@@ -1420,7 +1420,7 @@ describe('Parser', () => {
14201420
['_:b3', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://ex.org/x/yy/zzz/d'],
14211421
['_:b3', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil']));
14221422

1423-
it('should respect @base statements',
1423+
describe('should respect @base statements',
14241424
shouldParse(parser,
14251425
'<a> <b> <c>.\n' +
14261426
'@base <http://ex.org/x/>.\n' +
@@ -1553,7 +1553,7 @@ describe('Parser', () => {
15531553
it('should parse a single triple chunked after an opening bracket',
15541554
shouldParseChunks(parser, ['<a> <', 'b> <c>.'], ['a', 'b', 'c']));
15551555

1556-
it('should parse a single triple',
1556+
describe('should parse a single triple',
15571557
shouldParse(parser, '<a> <b> <c>.', ['a', 'b', 'c']));
15581558

15591559
describe('should parse a default graph',
@@ -1758,13 +1758,13 @@ describe('Parser', () => {
17581758
it('should not parse a quad',
17591759
shouldNotParse(parser, '<a> <b> <c> <d>.', 'Expected punctuation to follow "http://example.org/c" on line 1.'));
17601760

1761-
it('allows a blank node in predicate position',
1761+
describe('allows a blank node in predicate position',
17621762
shouldParse(parser, '<a> [] <c>.', ['a', '_:b0', 'c']));
17631763

1764-
it('allows a blank node label in predicate position',
1764+
describe('allows a blank node label in predicate position',
17651765
shouldParse(parser, '<a> _:b <c>.', ['a', '_:b0_b', 'c']));
17661766

1767-
it('allows a blank node with properties in predicate position',
1767+
describe('allows a blank node with properties in predicate position',
17681768
shouldParse(parser, '<a> [<p> <o>] <c>.',
17691769
['a', '_:b0', 'c'],
17701770
['_:b0', 'p', 'o']));
@@ -1796,7 +1796,6 @@ describe('Parser', () => {
17961796
['?a', '?b', 'c', '_:b0'],
17971797
['d', 'e', '?a', '_:b1']));
17981798

1799-
18001799
describe('should parse a right implication between two-triple graphs',
18011800
shouldParse(parser, '{ ?a ?b <c>. <d> <e> <f>. } => { <d> <e> ?a, <f> }.',
18021801
['_:b0', 'http://www.w3.org/2000/10/swap/log#implies', '_:b1'],
@@ -1872,7 +1871,7 @@ describe('Parser', () => {
18721871
shouldNotParse(parser, '@forSome ?a.',
18731872
'Unexpected var on line 1.'));
18741873

1875-
it('should correctly scope @forSome statements',
1874+
describe('should correctly scope @forSome statements',
18761875
shouldParse(parser, '@forSome <x>. <x> <x> { @forSome <x>. <x> <x> <x>. }. <x> <x> <x>.',
18771876
['_:b0', '_:b0', '_:b1'],
18781877
['_:b2', '_:b2', '_:b2', '_:b1'],
@@ -1898,7 +1897,7 @@ describe('Parser', () => {
18981897
shouldNotParse(parser, '@forAll ?a.',
18991898
'Unexpected var on line 1.'));
19001899

1901-
it('should correctly scope @forAll statements',
1900+
describe('should correctly scope @forAll statements',
19021901
shouldParse(parser, '@forAll <x>. <x> <x> { @forAll <x>. <x> <x> <x>. }. <x> <x> <x>.',
19031902
['?b0', '?b0', '_:b1'],
19041903
['?b2', '?b2', '?b2', '_:b1'],
@@ -2127,7 +2126,7 @@ describe('Parser', () => {
21272126
['_:b2', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil', 'urn:n3:quantifiers'],
21282127
['a:x', 'b:y', 'a:z']));
21292128

2130-
it('should correctly scope @forSome statements',
2129+
describe('should correctly scope @forSome statements',
21312130
shouldParse(parser, '@forSome <x>. <x> <x> { @forSome <x>. <x> <x> <x>. }. <x> <x> <x>.',
21322131
['', 'http://www.w3.org/2000/10/swap/reify#forSome', '_:b0', 'urn:n3:quantifiers'],
21332132
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'x', 'urn:n3:quantifiers'],

0 commit comments

Comments
 (0)