Fix type not included in LET statement display (#4615)
This commit is contained in:
parent
9ca3a4d087
commit
6af8ea9165
1 changed files with 20 additions and 1 deletions
|
@ -57,6 +57,25 @@ impl SetStatement {
|
|||
|
||||
impl fmt::Display for SetStatement {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "LET ${} = {}", self.name, self.what)
|
||||
write!(f, "LET ${}", self.name)?;
|
||||
if let Some(ref kind) = self.kind {
|
||||
write!(f, ": {}", kind)?;
|
||||
}
|
||||
write!(f, " = {}", self.what)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::syn::parse;
|
||||
|
||||
#[test]
|
||||
fn check_type() {
|
||||
let query = parse("LET $param = 5").unwrap();
|
||||
assert_eq!(format!("{}", query), "LET $param = 5;");
|
||||
|
||||
let query = parse("LET $param: number = 5").unwrap();
|
||||
assert_eq!(format!("{}", query), "LET $param: number = 5;");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue