Skip to content

Commit

Permalink
TriGParserTest::testBlankNodes() adjusted
Browse files Browse the repository at this point in the history
* removed the prefixed-only IRIs input line from the first test scenario
  as this does not belong to the testBlankNodes() tests and is tested
  aleady in testIssue37()
* turned the empty prefixed IRIs test scenario into two - first, where
  and error is expected due to unknown document base IRI and second,
  where parsing succeeds thanks to `documentIRI` parser option being set
  • Loading branch information
zozlak committed Feb 28, 2024
1 parent 2bbfaf3 commit 7844f31
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/TriGParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,18 @@ public function testZeroOrMoreTriples(): void

public function testBlankNodes(): void
{
// should parse diamonds
$this->shouldParse("<> <> <> <>.\n(<>) <> (<>) <>.",
['', '', '', ''],
['_:b0', '', '_:b1', ''],
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', ''],
// should throw an error on empty list item with lacking document base IRI
$this->shouldNotParse("(<>) <> (<>) <>.",
"list item on line 1 can not be parsed without knowing the the document base IRI.\n".
"Please set the document base IRI using the documentIRI parser configuration option.\n".
"See https://github.com/pietercolpaert/hardf/#empty-document-base-IRI .");
// but should manage if the parser has documentIRI set
$this->shouldParse(function () { return new TriGParser(['documentIRI' => 'http://base/']); },
"(<>) <> (<>) <>.",
['_:b0', 'http://base/', '_:b1', 'http://base/'],
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://base/'],
['_:b0', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'],
['_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', ''],
['_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', 'http://base/'],
['_:b1', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil']);

// should parse statements with named blank nodes
Expand Down

0 comments on commit 7844f31

Please sign in to comment.