Pre: reformat query parser code.
This commit is contained in:
parent
fe307f8b7a
commit
11a9a30d35
1 changed files with 11 additions and 15 deletions
|
@ -201,25 +201,21 @@ mod test_parse {
|
||||||
let truncated_input = edn::Value::Vector(vec![Value::from_keyword(None, "find")]);
|
let truncated_input = edn::Value::Vector(vec![Value::from_keyword(None, "find")]);
|
||||||
assert!(parse_find(truncated_input).is_err());
|
assert!(parse_find(truncated_input).is_err());
|
||||||
|
|
||||||
let input = edn::Value::Vector(vec![
|
let input =
|
||||||
Value::from_keyword(None, "find"),
|
edn::Value::Vector(vec![Value::from_keyword(None, "find"),
|
||||||
Value::from_symbol(None, "?x"),
|
Value::from_symbol(None, "?x"),
|
||||||
Value::from_symbol(None, "?y"),
|
Value::from_symbol(None, "?y"),
|
||||||
Value::from_keyword(None, "where"),
|
Value::from_keyword(None, "where"),
|
||||||
edn::Value::Vector(vec![
|
edn::Value::Vector(vec![Value::from_symbol(None, "?x"),
|
||||||
Value::from_symbol(None, "?x"),
|
Value::from_keyword("foo", "bar"),
|
||||||
Value::from_keyword("foo", "bar"),
|
Value::from_symbol(None, "?y")])]);
|
||||||
Value::from_symbol(None, "?y"),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let parsed = parse_find(input).unwrap();
|
let parsed = parse_find(input).unwrap();
|
||||||
if let FindSpec::FindRel(elems) = parsed.find_spec {
|
if let FindSpec::FindRel(elems) = parsed.find_spec {
|
||||||
assert_eq!(2, elems.len());
|
assert_eq!(2, elems.len());
|
||||||
assert_eq!(vec![
|
assert_eq!(vec![Element::Variable(Variable(edn::PlainSymbol::new("?x"))),
|
||||||
Element::Variable(Variable(edn::PlainSymbol::new("?x"))),
|
Element::Variable(Variable(edn::PlainSymbol::new("?y")))],
|
||||||
Element::Variable(Variable(edn::PlainSymbol::new("?y"))),
|
elems);
|
||||||
], elems);
|
|
||||||
} else {
|
} else {
|
||||||
panic!("Expected FindRel.");
|
panic!("Expected FindRel.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue