Skip to content

Commit

Permalink
Final touch up
Browse files Browse the repository at this point in the history
  • Loading branch information
Qup42 committed May 27, 2024
1 parent 7f76294 commit 9b2e737
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/SparqlAntlrParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ TEST(SparqlParser, UpdateQuery) {
expectUpdateFails("INSERT DATA { ?a ?b ?c }");
expectUpdateFails("WITH <foo> DELETE { ?a ?b ?c } WHERE { ?a ?b ?c }");
expectUpdateFails("DELETE { ?a ?b ?c } USING <foo> WHERE { ?a ?b ?c }");
expectUpdateFails("INSERT DATA { GRAPH <foo> }");
expectUpdateFails("INSERT DATA { GRAPH <foo> { } }");
// Unsupported features.
expectUpdateFails(
"INSERT DATA { <a> <b> <c> } ; INSERT { ?a <b> <c> } WHERE { <d> <e> ?a "
Expand Down Expand Up @@ -1724,3 +1724,12 @@ TEST(SparqlParser, GraphOrDefault) {
testing::VariantWith<GraphRef>(AD_PROPERTY(
TripleComponent::Iri, toStringRepresentation, testing::Eq("<foo>"))));
}

TEST(SparqlParser, GraphRef) {
auto expectGraphRefAll = ExpectCompleteParse<&Parser::graphRefAll>{
{{INTERNAL_PREDICATE_PREFIX_NAME, INTERNAL_PREDICATE_PREFIX_IRI}}};
expectGraphRefAll("DEFAULT", m::Variant<DEFAULT>());
expectGraphRefAll("NAMED", m::Variant<NAMED>());
expectGraphRefAll("ALL", m::Variant<ALL>());
expectGraphRefAll("GRAPH <foo>", m::GraphRefIri("<foo>"));
}
8 changes: 8 additions & 0 deletions test/SparqlAntlrParserTestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,4 +852,12 @@ inline auto UpdateQuery =
RootGraphPattern(graphPatternMatcher));
};

template <typename T>
auto inline Variant = []() { return testing::VariantWith<T>(testing::_); };

auto inline GraphRefIri = [](const string& iri) {
return testing::VariantWith<GraphRef>(AD_PROPERTY(
TripleComponent::Iri, toStringRepresentation, testing::Eq(iri)));
};

} // namespace matchers

0 comments on commit 9b2e737

Please sign in to comment.