diff --git a/test/SparqlAntlrParserTest.cpp b/test/SparqlAntlrParserTest.cpp index 7efdb4b93a..73afdc996d 100644 --- a/test/SparqlAntlrParserTest.cpp +++ b/test/SparqlAntlrParserTest.cpp @@ -1695,7 +1695,7 @@ TEST(SparqlParser, UpdateQuery) { expectUpdateFails("INSERT DATA { ?a ?b ?c }"); expectUpdateFails("WITH DELETE { ?a ?b ?c } WHERE { ?a ?b ?c }"); expectUpdateFails("DELETE { ?a ?b ?c } USING WHERE { ?a ?b ?c }"); - expectUpdateFails("INSERT DATA { GRAPH }"); + expectUpdateFails("INSERT DATA { GRAPH { } }"); // Unsupported features. expectUpdateFails( "INSERT DATA { } ; INSERT { ?a } WHERE { ?a " @@ -1724,3 +1724,12 @@ TEST(SparqlParser, GraphOrDefault) { testing::VariantWith(AD_PROPERTY( TripleComponent::Iri, toStringRepresentation, testing::Eq("")))); } + +TEST(SparqlParser, GraphRef) { + auto expectGraphRefAll = ExpectCompleteParse<&Parser::graphRefAll>{ + {{INTERNAL_PREDICATE_PREFIX_NAME, INTERNAL_PREDICATE_PREFIX_IRI}}}; + expectGraphRefAll("DEFAULT", m::Variant()); + expectGraphRefAll("NAMED", m::Variant()); + expectGraphRefAll("ALL", m::Variant()); + expectGraphRefAll("GRAPH ", m::GraphRefIri("")); +} diff --git a/test/SparqlAntlrParserTestHelpers.h b/test/SparqlAntlrParserTestHelpers.h index 67d135be9d..af89918a88 100644 --- a/test/SparqlAntlrParserTestHelpers.h +++ b/test/SparqlAntlrParserTestHelpers.h @@ -852,4 +852,12 @@ inline auto UpdateQuery = RootGraphPattern(graphPatternMatcher)); }; +template +auto inline Variant = []() { return testing::VariantWith(testing::_); }; + +auto inline GraphRefIri = [](const string& iri) { + return testing::VariantWith(AD_PROPERTY( + TripleComponent::Iri, toStringRepresentation, testing::Eq(iri))); +}; + } // namespace matchers