Fix formatter for unary operation
Was wrongly converting any unary operation into '!'
This commit is contained in:
@@ -14,7 +14,7 @@ fn assert_fmt(src: &str, expected: &str) {
|
||||
let (module2, extra2) = parser::module(&out, ModuleKind::Lib).unwrap();
|
||||
let mut out2 = String::new();
|
||||
format::pretty(&mut out2, module2, extra2, &out);
|
||||
assert_eq!(out, out2);
|
||||
assert!(out == out2, "formatting isn't idempotent");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -197,3 +197,20 @@ fn test_format_imports() {
|
||||
|
||||
assert_fmt(src, expected)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_negate() {
|
||||
let src = indoc! {r#"
|
||||
fn foo() {
|
||||
- 42
|
||||
}
|
||||
"#};
|
||||
|
||||
let expected = indoc! {r#"
|
||||
fn foo() {
|
||||
-42
|
||||
}
|
||||
"#};
|
||||
|
||||
assert_fmt(src, expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user