parent
0a4b810fbd
commit
d2761c6bf6
2 changed files with 18 additions and 3 deletions
|
@ -86,6 +86,12 @@ pub fn param(i: &str) -> IResult<&str, Param> {
|
|||
Ok((i, Param::from(v)))
|
||||
}
|
||||
|
||||
pub fn basic(i: &str) -> IResult<&str, Param> {
|
||||
let (i, _) = char('$')(i)?;
|
||||
let (i, v) = idiom::basic(i)?;
|
||||
Ok((i, Param::from(v)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::sql::comment::shouldbespace;
|
|||
use crate::sql::data::{data, Data};
|
||||
use crate::sql::error::IResult;
|
||||
use crate::sql::output::{output, Output};
|
||||
use crate::sql::param::param;
|
||||
use crate::sql::param::basic as param;
|
||||
use crate::sql::subquery::subquery;
|
||||
use crate::sql::table::{table, Table};
|
||||
use crate::sql::thing::thing;
|
||||
|
@ -271,7 +271,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn relate_statement_in() {
|
||||
let sql = "RELATE person:tobie->like->animal:koala";
|
||||
let sql = "RELATE animal:koala<-like<-person:tobie";
|
||||
let res = relate(sql);
|
||||
assert!(res.is_ok());
|
||||
let out = res.unwrap().1;
|
||||
|
@ -280,10 +280,19 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn relate_statement_out() {
|
||||
let sql = "RELATE animal:koala<-like<-person:tobie";
|
||||
let sql = "RELATE person:tobie->like->animal:koala";
|
||||
let res = relate(sql);
|
||||
assert!(res.is_ok());
|
||||
let out = res.unwrap().1;
|
||||
assert_eq!("RELATE person:tobie -> like -> animal:koala", format!("{}", out))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn relate_statement_params() {
|
||||
let sql = "RELATE $tobie->like->$koala";
|
||||
let res = relate(sql);
|
||||
assert!(res.is_ok());
|
||||
let out = res.unwrap().1;
|
||||
assert_eq!("RELATE $tobie -> like -> $koala", format!("{}", out))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue