Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
topecongiro committed Jun 3, 2017
1 parent 96901e1 commit 505458d
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 25 deletions.
5 changes: 3 additions & 2 deletions tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ fn print_mismatches(result: HashMap<String, Vec<Mismatch>>) {
let mut t = term::stdout().unwrap();

for (file_name, diff) in result {
print_diff(diff,
|line_num| format!("\nMismatch at {}:{}:", file_name, line_num));
print_diff(diff, |line_num| {
format!("\nMismatch at {}:{}:", file_name, line_num)
});
}

t.reset().unwrap();
Expand Down
9 changes: 3 additions & 6 deletions tests/target/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,9 @@ fn try_shorthand() {
.0
.x;

parameterized(f,
substs,
def_id,
Ns::Value,
&[],
|tcx| tcx.lookup_item_type(def_id).generics)?;
parameterized(f, substs, def_id, Ns::Value, &[], |tcx| {
tcx.lookup_item_type(def_id).generics
})?;
fooooooooooooooooooooooooooo()?
.bar()?
.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?;
Expand Down
120 changes: 120 additions & 0 deletions tests/target/combining.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// rustfmt-fn_call_style: Block
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.

fn main() {
// Call
foo(bar(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// Mac
foo(foo!(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// MethodCall
foo(x.foo::<Bar, Baz>(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// Block
foo!({
foo();
bar();
});

// Closure
foo(|x| {
let y = x + 1;
y
});

// Match
foo(match opt {
Some(x) => x,
None => y,
});

// Struct
foo(Bar {
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
});

// If
foo!(if x {
foo();
} else {
bar();
});

// IfLet
foo!(if let Some(..) = x {
foo();
} else {
bar();
});

// While
foo!(while x {
foo();
bar();
});

// WhileLet
foo!(while let Some(..) = x {
foo();
bar();
});

// ForLoop
foo!(for x in y {
foo();
bar();
});

// Loop
foo!(loop {
foo();
bar();
});

// Tuple
foo((
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// AddrOf
foo(&bar(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// Box
foo(box Bar {
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
});

// Unary
foo(!bar(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
));

// Try
foo(bar(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
)?);

// Cast
foo(Bar {
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
} as i64);
}
9 changes: 4 additions & 5 deletions tests/target/configs-fn_call_style-block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ impl Cursor {
}

fn issue1581() {
bootstrap.checks.register(
"PERSISTED_LOCATIONS",
move || if locations2.0.inner_mut.lock().poisoned {
bootstrap.checks.register("PERSISTED_LOCATIONS", move || {
if locations2.0.inner_mut.lock().poisoned {
Check::new(
State::Error,
"Persisted location storage is poisoned due to a write failure",
)
} else {
Check::new(State::Healthy, "Persisted location storage is healthy")
},
);
}
});
}
14 changes: 7 additions & 7 deletions tests/target/hard-tabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ fn main() {
}

loong_func().quux(move || if true {
1
} else {
2
});
1
} else {
2
});

fffffffffffffffffffffffffffffffffff(a, {
SCRIPT_TASK_ROOT.with(|root| { *root.borrow_mut() = Some(&script_task); });
});
a.b.c.d();

x().y(|| match cond() {
true => (),
false => (),
});
true => (),
false => (),
});
}
13 changes: 8 additions & 5 deletions tests/target/nested-visual-block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ fn main() {
});

// #1581
bootstrap.checks.register(
"PERSISTED_LOCATIONS",
move || if locations2.0.inner_mut.lock().poisoned {
bootstrap
.checks
.register("PERSISTED_LOCATIONS", move || if locations2
.0
.inner_mut
.lock()
.poisoned {
Check::new(State::Error,
"Persisted location storage is poisoned due to a write failure")
} else {
Check::new(State::Healthy, "Persisted location storage is healthy")
}
);
});
}

0 comments on commit 505458d

Please sign in to comment.