use super::*;
use relate_names::SmallName;
#[test]
fn test_parse_create() {
let stmt = parse("CREATE (n:Person {name: 'Bob'})").unwrap();
assert_eq!(stmt.clauses.len(), 1);
match &stmt.clauses[0] {
Clause::Create(c) => {
assert_eq!(c.pattern.len(), 1);
}
_ => panic!("expected create"),
}
}
#[test]
fn test_parse_merge() {
let stmt = parse("MERGE (n:Person {name: 'Bob'}) ON CREATE SET n.created = true ON MATCH SET n.updated = true").unwrap();
match &stmt.clauses[0] {
Clause::Merge(m) => {
assert_eq!(m.on_create.len(), 1);
assert_eq!(m.on_match.len(), 1);
}
_ => panic!("expected merge"),
}
}
#[test]
fn test_parse_delete() {
let stmt = parse("MATCH (n) DELETE n").unwrap();
assert_eq!(stmt.clauses.len(), 2);
match &stmt.clauses[1] {
Clause::Delete(d) => {
assert!(!d.detach);
assert_eq!(d.expressions.len(), 1);
}
_ => panic!("expected delete"),
}
}
#[test]
fn test_parse_detach_delete() {
let stmt = parse("MATCH (n) DETACH DELETE n").unwrap();
match &stmt.clauses[1] {
Clause::Delete(d) => {
assert!(d.detach);
}
_ => panic!("expected delete"),
}
}
#[test]
fn test_parse_nodetach_delete() {
let stmt = parse("MATCH (n) NODETACH DELETE n").unwrap();
match &stmt.clauses[1] {
Clause::Delete(d) => {
assert!(!d.detach);
assert_eq!(d.expressions.len(), 1);
}
_ => panic!("expected delete"),
}
}
#[test]
fn test_parse_nodetach_delete_case_insensitive() {
let stmt = parse("MATCH (n) nodetach delete n").unwrap();
match &stmt.clauses[1] {
Clause::Delete(d) => assert!(!d.detach),
_ => panic!("expected delete"),
}
}
#[test]
fn test_parse_nodetach_still_usable_as_identifier() {
let stmt = parse("MATCH (nodetach:Person) RETURN nodetach.name AS name").unwrap();
match &stmt.clauses[0] {
Clause::Match(m) => match &m.pattern[0].elements[0] {
PatternElement::Node(np) => {
assert_eq!(np.variable, Some("nodetach".into()));
}
_ => panic!("expected node pattern"),
},
_ => panic!("expected match"),
}
}
#[test]
fn test_parse_detach_nodetach_combo_is_error() {
assert!(parse("MATCH (n) DETACH NODETACH DELETE n").is_err());
}
#[test]
fn test_parse_nodetach_without_delete_is_error() {
assert!(parse("MATCH (n) NODETACH RETURN n").is_err());
}
#[test]
fn test_parse_insert_basic() {
let stmt = parse("INSERT (n:A&B {x: 1})").unwrap();
match &stmt.clauses[0] {
Clause::Create(cc) => assert!(cc.is_insert),
_ => panic!("expected create"),
}
let stmt = parse("CREATE (n:A)").unwrap();
match &stmt.clauses[0] {
Clause::Create(cc) => assert!(!cc.is_insert),
_ => panic!("expected create"),
}
}
#[test]
fn test_parse_insert_rejects_colon_conjunction() {
assert!(parse("INSERT (n :A:B)").is_err());
}
#[test]
fn test_parse_insert_rejects_named_path() {
assert!(parse("INSERT p = (a)-[r:R]->(b)").is_err());
}
#[test]
fn test_parse_insert_rejects_parenthesized_label_expr() {
assert!(parse("INSERT (n:(A:B):C)").is_err());
}
#[test]
fn test_parse_create_still_allows_named_path_and_parens() {
assert!(parse("CREATE p = (a)-[r:R]->(b)").is_ok());
assert!(parse("CREATE (n:(A:B):C)").is_ok());
}
#[test]
fn test_parse_set() {
let stmt = parse("MATCH (n) SET n.name = 'Alice', n:Person").unwrap();
match &stmt.clauses[1] {
Clause::Set(s) => {
assert_eq!(s.items.len(), 2);
assert!(s.items[0].property.is_some());
assert_eq!(s.items[1].labels, vec![LabelExpr::Label("Person".into())]);
}
_ => panic!("expected set"),
}
}
#[test]
fn test_parse_remove() {
let stmt = parse("MATCH (n) REMOVE n.name, n:Person").unwrap();
match &stmt.clauses[1] {
Clause::Remove(r) => {
assert_eq!(r.items.len(), 2);
}
_ => panic!("expected remove"),
}
}
#[test]
fn test_parse_return_with_alias() {
let stmt = parse("MATCH (n) RETURN n.name AS name").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert_eq!(r.items[0].alias, Some("name".into()));
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_order_by() {
let stmt = parse("MATCH (n) RETURN n ORDER BY n.name DESC").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert_eq!(r.order_by.len(), 1);
assert!(r.order_by[0].descending);
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_skip_limit() {
let stmt = parse("MATCH (n) RETURN n SKIP 5 LIMIT 10").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert!(r.skip.is_some());
assert!(r.limit.is_some());
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_with() {
let stmt = parse("MATCH (n) WITH n.name AS name WHERE name = 'Alice' RETURN name").unwrap();
match &stmt.clauses[1] {
Clause::With(w) => {
assert_eq!(w.items.len(), 1);
assert!(w.where_expr.is_some());
}
_ => panic!("expected with"),
}
}
#[test]
fn test_parse_unwind() {
let stmt = parse("UNWIND [1, 2, 3] AS x RETURN x").unwrap();
match &stmt.clauses[0] {
Clause::Unwind(u) => {
assert_eq!(u.alias, "x");
}
_ => panic!("expected unwind"),
}
}
#[test]
fn clause_starter_table_covers_the_dispatch() {
use crate::token::CLAUSE_STARTER_TOKENS;
for ty in CLAUSE_STARTER_TOKENS {
let spelling = format!("{ty:?}").to_lowercase();
let generic = format!("unexpected token {spelling:?}");
if let Err(err) = parse(&spelling) {
assert_ne!(
err.message, generic,
"{spelling} is in the starter table but not the clause dispatch"
);
}
}
}
#[test]
fn test_parse_union() {
let stmt = parse("MATCH (n:A) RETURN n UNION MATCH (n:B) RETURN n").unwrap();
assert!(stmt.union.is_some());
assert!(!stmt.union.as_ref().unwrap().all);
}
#[test]
fn test_parse_union_all() {
let stmt = parse("MATCH (n:A) RETURN n UNION ALL MATCH (n:B) RETURN n").unwrap();
assert!(stmt.union.as_ref().unwrap().all);
}
#[test]
fn test_parse_union_distinct() {
let stmt = parse("MATCH (n:A) RETURN n UNION DISTINCT MATCH (n:B) RETURN n").unwrap();
assert!(!stmt.union.as_ref().unwrap().all);
}
#[test]
fn test_parse_union_distinct_chain_mixed_with_plain_union() {
let stmt = parse("RETURN 1 AS x UNION DISTINCT RETURN 2 AS x UNION RETURN 3 AS x").unwrap();
assert!(!stmt.union.as_ref().unwrap().all);
let second = &stmt.union.as_ref().unwrap().statement;
assert!(!second.union.as_ref().unwrap().all);
}
#[test]
fn test_parse_optional_match() {
let stmt = parse("OPTIONAL MATCH (n) RETURN n").unwrap();
match &stmt.clauses[0] {
Clause::Match(m) => assert!(m.optional),
_ => panic!("expected match"),
}
}
#[test]
fn test_using_index_hint_is_parsed_and_ignored() {
let stmt =
parse("MATCH (n:Person) USING INDEX n:Person(age) WHERE n.age = 30 RETURN n").unwrap();
match &stmt.clauses[0] {
Clause::Match(m) => assert!(m.where_expr.is_some()),
other => panic!("expected Match clause, got {other:?}"),
}
assert!(parse("MATCH (n:Person) USING INDEX SEEK n:Person(age) RETURN n").is_ok());
}
#[test]
fn test_using_scan_is_parsed_and_join_hints_are_retained() {
assert!(parse("MATCH (n:Person) USING SCAN n:Person RETURN n").is_ok());
let stmt =
parse("MATCH (a:A), (b:B) USING JOIN ON a, b WHERE a.id = b.id RETURN a, b").unwrap();
match &stmt.clauses[0] {
Clause::Match(m) => {
let keys = m
.using_join
.iter()
.map(|hint| {
hint.variables
.iter()
.map(|v| v.to_string())
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
assert_eq!(keys, [vec!["a".to_string(), "b".to_string()]]);
}
other => panic!("expected Match clause, got {other:?}"),
}
}
#[test]
fn test_using_join_without_on_is_rejected() {
let err = parse("MATCH (a:A), (b:B) USING JOIN a, b WHERE a.id = b.id RETURN a, b")
.expect_err("USING JOIN without ON must not parse");
assert!(
err.message.starts_with("expected ON"),
"the error should name the missing ON: {}",
err.message
);
}
#[test]
fn test_parse_explain() {
let stmt = parse("EXPLAIN MATCH (n) RETURN n").unwrap();
assert_eq!(stmt.preamble, PreambleMode::Explain);
}
#[test]
fn test_parse_profile() {
let stmt = parse("PROFILE MATCH (n) RETURN n").unwrap();
assert_eq!(stmt.preamble, PreambleMode::Profile);
}
#[test]
fn test_parse_foreach() {
let stmt = parse("FOREACH (x IN [1, 2, 3] | CREATE (n {val: x}))").unwrap();
match &stmt.clauses[0] {
Clause::Foreach(f) => {
assert_eq!(f.variable, "x");
assert_eq!(f.clauses.len(), 1);
}
_ => panic!("expected foreach"),
}
}
#[test]
fn test_parse_with_star_then_more_items() {
let stmt = parse("MATCH (n) WITH *, n.name AS x RETURN x").unwrap();
match &stmt.clauses[1] {
Clause::With(w) => {
assert_eq!(w.items.len(), 2);
assert!(w.items[0].all);
assert!(!w.items[1].all);
assert_eq!(w.items[1].alias.as_ref(), Some(&SmallName::from_name("x")));
}
_ => panic!("expected with"),
}
}
#[test]
fn test_parse_return_star_then_more_items() {
let stmt = parse("MATCH (n) RETURN *, n.name AS x").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert_eq!(r.items.len(), 2);
assert!(r.items[0].all);
assert!(!r.items[1].all);
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_return_star_alone_still_works() {
let stmt = parse("MATCH (n) RETURN *").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert_eq!(r.items.len(), 1);
assert!(r.items[0].all);
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_return_all_modifier() {
let with_all = parse("MATCH (n) RETURN ALL n.prop AS prop").unwrap();
let without = parse("MATCH (n) RETURN n.prop AS prop").unwrap();
assert_eq!(with_all, without);
match &with_all.clauses[1] {
Clause::Return(r) => assert!(!r.distinct),
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_with_all_modifier() {
let with_all = parse("MATCH (n) WITH ALL n.prop AS prop RETURN prop").unwrap();
let without = parse("MATCH (n) WITH n.prop AS prop RETURN prop").unwrap();
assert_eq!(with_all, without);
match &with_all.clauses[1] {
Clause::With(w) => assert!(!w.distinct),
_ => panic!("expected with"),
}
}
#[test]
fn test_parse_return_all_star_is_not_confused_with_all_quantifier() {
let stmt = parse("UNWIND [1, 2] AS x RETURN ALL *").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => {
assert_eq!(r.items.len(), 1);
assert!(r.items[0].all);
assert!(!r.distinct);
}
_ => panic!("expected return"),
}
let quantifier_stmt = parse("RETURN all(x IN [1, 2, 3] WHERE x > 0) AS r").unwrap();
match &quantifier_stmt.clauses[0] {
Clause::Return(r) => {
assert_eq!(r.items.len(), 1);
assert!(!r.items[0].all);
assert!(matches!(r.items[0].expr, Expr::Quantifier(_)));
}
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_return_all_distinct_is_a_syntax_error() {
assert!(parse("MATCH (n) RETURN ALL DISTINCT n.prop AS prop").is_err());
assert!(parse("MATCH (n) WITH ALL DISTINCT n.prop AS prop RETURN prop").is_err());
}
#[test]
fn test_parse_distinct() {
let stmt = parse("MATCH (n) RETURN DISTINCT n").unwrap();
match &stmt.clauses[1] {
Clause::Return(r) => assert!(r.distinct),
_ => panic!("expected return"),
}
}
#[test]
fn test_parse_load_csv() {
let stmt = parse("LOAD CSV WITH HEADERS FROM 'file.csv' AS row RETURN row").unwrap();
match &stmt.clauses[0] {
Clause::LoadCSV(l) => {
assert!(l.with_headers);
assert_eq!(l.alias, "row");
}
_ => panic!("expected load csv"),
}
}
#[test]
fn test_load_csv_field_terminator_must_be_a_string_literal() {
let stmt = parse("LOAD CSV FROM 'file.tsv' AS row FIELDTERMINATOR '\\t' RETURN row").unwrap();
match &stmt.clauses[0] {
Clause::LoadCSV(l) => assert_eq!(l.field_terminator.as_deref(), Some("\t")),
other => panic!("expected load csv, got {other:?}"),
}
for q in [
"LOAD CSV FROM 'file.tsv' AS row FIELDTERMINATOR 1 RETURN row",
"LOAD CSV FROM 'file.tsv' AS row FIELDTERMINATOR $sep RETURN row",
] {
let err = parse(q).expect_err("non-literal FIELDTERMINATOR must fail the parse");
assert!(
err.message
.starts_with("expected a string literal after FIELDTERMINATOR"),
"{q:?}: {}",
err.message
);
}
}
#[test]
fn test_parse_yield_all() {
let stmt = parse("CALL db.labels() YIELD *").unwrap();
match &stmt.clauses[0] {
Clause::CallProcedure(c) => {
assert!(c.yields.all);
}
_ => panic!("expected call procedure"),
}
}
#[test]
fn test_parse_error_position() {
let err = parse("MATCH (n) BLAH").unwrap_err();
assert!(err.message.contains("BLAH"));
}
#[test]
fn test_parse_set_merge_props() {
let stmt = parse("MATCH (n) SET n += {age: 30}").unwrap();
match &stmt.clauses[1] {
Clause::Set(s) => {
assert!(s.items[0].merge);
assert!(s.items[0].variable.is_some());
}
_ => panic!("expected set"),
}
}
#[test]
fn test_parse_with_distinct() {
let stmt = parse("MATCH (n) WITH DISTINCT n RETURN n").unwrap();
match &stmt.clauses[1] {
Clause::With(w) => assert!(w.distinct),
_ => panic!("expected with"),
}
}
#[test]
fn test_use_clause_parses_as_noop() {
let stmt = parse("WITH 'g' AS g USE graph.byName(g) RETURN 1 AS x").unwrap();
match &stmt.clauses[1] {
Clause::Use(uc) => match &uc.graph_expr {
Expr::FunctionCall(fc) => assert_eq!(fc.name, "graph.byName"),
other => panic!("expected function call, got {other:?}"),
},
other => panic!("expected Use clause, got {other:?}"),
}
}
#[test]
fn test_let_clause_desugars_to_with_star() {
let stmt = parse("LET x = 1 + 1 RETURN x").unwrap();
match &stmt.clauses[0] {
Clause::With(wc) => {
assert_eq!(wc.items.len(), 2);
assert!(wc.items[0].all);
assert_eq!(wc.items[1].alias.as_ref(), Some(&SmallName::from_name("x")));
}
other => panic!("expected With clause, got {other:?}"),
}
}
#[test]
fn test_let_clause_multiple_bindings() {
let stmt = parse("LET x = 1, y = 2 RETURN x, y").unwrap();
match &stmt.clauses[0] {
Clause::With(wc) => {
assert_eq!(wc.items.len(), 3);
assert_eq!(wc.items[1].alias.as_ref(), Some(&SmallName::from_name("x")));
assert_eq!(wc.items[2].alias.as_ref(), Some(&SmallName::from_name("y")));
}
other => panic!("expected With clause, got {other:?}"),
}
}
#[test]
fn test_finish_clause_parses() {
let stmt = parse("MATCH (n) FINISH").unwrap();
assert_eq!(stmt.clauses.len(), 2);
assert_eq!(stmt.clauses[1], Clause::Finish);
}
#[test]
fn test_standalone_order_by_page_parses() {
let stmt = parse("MATCH (n) ORDER BY n.name SKIP 1 LIMIT 3 RETURN n").unwrap();
match &stmt.clauses[1] {
Clause::StandaloneOrderBy(sc) => {
assert_eq!(sc.stages.len(), 3);
assert!(matches!(sc.stages[0], PageStage::OrderBy(_)));
assert!(matches!(sc.stages[1], PageStage::Skip(_)));
assert!(matches!(sc.stages[2], PageStage::Limit(_)));
}
other => panic!("expected StandaloneOrderBy clause, got {other:?}"),
}
}
#[test]
fn test_standalone_page_preserves_written_stage_order() {
let stmt = parse("MATCH (n) LIMIT 3 OFFSET 1 RETURN n").unwrap();
match &stmt.clauses[1] {
Clause::StandaloneOrderBy(sc) => {
assert_eq!(sc.stages.len(), 2);
assert!(matches!(sc.stages[0], PageStage::Limit(_)));
assert!(matches!(sc.stages[1], PageStage::Skip(_)));
}
other => panic!("expected StandaloneOrderBy clause, got {other:?}"),
}
}
#[test]
fn test_offset_is_a_skip_synonym_everywhere() {
match &parse("MATCH (n) OFFSET 1 RETURN n").unwrap().clauses[1] {
Clause::StandaloneOrderBy(sc) => assert!(matches!(sc.stages[0], PageStage::Skip(_))),
other => panic!("expected StandaloneOrderBy clause, got {other:?}"),
}
match &parse("MATCH (n) WITH n OFFSET 1 RETURN n").unwrap().clauses[1] {
Clause::With(wc) => assert!(wc.skip.is_some()),
other => panic!("expected With clause, got {other:?}"),
}
match &parse("MATCH (n) RETURN n OFFSET 1").unwrap().clauses[1] {
Clause::Return(rc) => assert!(rc.skip.is_some()),
other => panic!("expected Return clause, got {other:?}"),
}
assert!(parse("MATCH (n) RETURN n.offset AS x").is_ok());
}
#[test]
fn test_group_by_spec_forms() {
assert_eq!(
return_group_by("UNWIND [1,1,2] AS x RETURN x, count(*) AS c GROUP BY x"),
Some(GroupBySpec::Keys(vec![Expr::Variable("x".into())]))
);
assert_eq!(
return_group_by("UNWIND [1,2] AS x RETURN count(*) AS c GROUP BY ()"),
Some(GroupBySpec::Empty)
);
assert_eq!(
return_group_by("UNWIND [1,2] AS x RETURN count(*) AS c GROUP BY () ORDER BY c"),
Some(GroupBySpec::Empty)
);
assert_eq!(
return_group_by("UNWIND [1,2] AS x RETURN x, count(*) AS c GROUP BY ALL"),
Some(GroupBySpec::All)
);
let paren = return_group_by("UNWIND [1,2] AS x RETURN x + 0 AS k, count(*) AS c GROUP BY (x)");
assert_eq!(
paren,
Some(GroupBySpec::Keys(vec![Expr::Paren(Box::new(
Expr::Variable("x".into())
))]))
);
let all_call =
return_group_by("UNWIND [1,2] AS x RETURN all(x) AS a, count(*) AS c GROUP BY all(x)");
match all_call {
Some(GroupBySpec::Keys(keys)) => {
assert_eq!(keys.len(), 1);
match &keys[0] {
Expr::FunctionCall(f) => {
assert_eq!(f.name.with_str(str::to_ascii_lowercase), "all")
}
other => panic!("expected all(...) function call, got {other:?}"),
}
}
other => panic!("expected a single key, got {other:?}"),
}
}
#[test]
fn test_group_by_empty_before_load_csv_and_drop() {
for q in [
"UNWIND [1,2] AS x WITH count(*) AS c GROUP BY () LOAD CSV FROM 'x.csv' AS row RETURN row",
"UNWIND [1,2] AS x WITH count(*) AS c GROUP BY () DROP INDEX nope",
] {
let stmt = parse(q).unwrap();
let grouped = stmt
.clauses
.iter()
.find_map(|c| match c {
Clause::With(w) => Some(w.group_by.clone()),
_ => None,
})
.unwrap();
assert_eq!(grouped, Some(GroupBySpec::Empty), "query: {q}");
}
}
#[test]
fn test_group_by_empty_before_subquery_close() {
let stmt =
parse("CALL { UNWIND [1,2] AS x RETURN count(*) AS c GROUP BY () } RETURN c").unwrap();
let Clause::CallSubquery(call) = &stmt.clauses[0] else {
panic!("expected CallSubquery as the first clause");
};
let Clause::Return(inner) = call.statement.clauses.last().unwrap() else {
panic!("expected the subquery to end in RETURN");
};
assert_eq!(inner.group_by, Some(GroupBySpec::Empty));
}
#[test]
fn test_set_remove_target_starting_with_list_comprehension() {
for q in [
"MATCH (n:N) WITH collect(n) AS ns SET [x IN ns WHERE x.num = 1][0].num = -1 RETURN ns",
"MATCH (n:N) WITH collect(n) AS ns REMOVE [x IN ns WHERE x.num = 1][0].num RETURN ns",
"MATCH (n:N) WITH collect(n) AS ns SET [n][0].num = 1 RETURN ns",
] {
assert!(parse(q).is_ok(), "{q} must parse");
}
}
#[test]
fn test_show_family_paging_before_where() {
let stmt = parse(
"SHOW PROCEDURES YIELD name AS nm ORDER BY nm SKIP 1 LIMIT 5 \
WHERE nm CONTAINS 'Index' RETURN *",
)
.unwrap();
let Clause::ShowProcedures(show) = &stmt.clauses[0] else {
panic!("expected ShowProcedures");
};
assert_eq!(show.stages.len(), 3);
assert!(show.where_expr.is_some());
for q in [
"SHOW SETTINGS YIELD name ORDER BY name LIMIT 1",
"SHOW FUNCTIONS YIELD name SKIP 2",
"SHOW DATABASES YIELD name ORDER BY name",
"SHOW ROLES YIELD role LIMIT 1",
"SHOW SERVERS YIELD name SKIP 1",
"SHOW USERS YIELD user ORDER BY user",
"SHOW TRANSACTIONS YIELD transactionId LIMIT 1",
] {
assert!(parse(q).is_ok(), "{q} must parse");
}
}
#[test]
fn test_show_procedures_and_functions_executable_tail() {
let stmt = parse("SHOW PROCEDURES EXECUTABLE YIELD name").unwrap();
let Clause::ShowProcedures(show) = &stmt.clauses[0] else {
panic!("expected ShowProcedures");
};
assert_eq!(show.executable, None);
let stmt = parse("SHOW FUNCTIONS EXECUTABLE BY bob YIELD name").unwrap();
let Clause::ShowFunctions(show) = &stmt.clauses[0] else {
panic!("expected ShowFunctions");
};
assert_eq!(show.executable, Some(ExecutableBy::User("bob".into())));
let stmt = parse("SHOW PROCEDURES EXECUTABLE BY CURRENT USER YIELD name").unwrap();
let Clause::ShowProcedures(show) = &stmt.clauses[0] else {
panic!("expected ShowProcedures");
};
assert_eq!(show.executable, Some(ExecutableBy::Current));
assert!(parse("SHOW PROCEDURES EXECUTABLE BY 'bob' YIELD name").is_err());
}
#[test]
fn test_relationship_lookup_index_accepts_each_less_on() {
assert!(parse("CREATE LOOKUP INDEX my_index FOR ()-[r]-() ON type(r)").is_ok());
assert!(parse("CREATE LOOKUP INDEX my_index FOR ()-[r]-() ON EACH type(r)").is_ok());
assert!(parse("CREATE LOOKUP INDEX my_index FOR (n) ON labels(n)").is_err());
assert!(parse("CREATE FULLTEXT INDEX ft FOR (n:L) ON (n.p)").is_err());
}