Add some tests for hard tab mode.
This commit is contained in:
parent
620650219e
commit
05c8c28935
69
tests/source/hard-tabs.rs
Normal file
69
tests/source/hard-tabs.rs
Normal file
@ -0,0 +1,69 @@
|
||||
// rustfmt-hard_tabs: true
|
||||
|
||||
fn main() {
|
||||
let x = Bar;
|
||||
|
||||
let y = Foo {a: x };
|
||||
|
||||
Foo { a: foo() /* comment*/, /* comment*/ b: bar(), ..something };
|
||||
|
||||
fn foo(a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32) {}
|
||||
|
||||
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
|
||||
|
||||
if let (some_very_large, tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1
|
||||
+ 2 + 3 {
|
||||
}
|
||||
|
||||
if cond() {
|
||||
something();
|
||||
} else if different_cond() {
|
||||
something_else();
|
||||
} else {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
}
|
||||
|
||||
unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong comment */ {}
|
||||
|
||||
unsafe // So this is a very long comment.
|
||||
// Multi-line, too.
|
||||
// Will it still format correctly?
|
||||
{
|
||||
}
|
||||
|
||||
let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz, q];
|
||||
|
||||
fn generic<T>(arg: T) -> &SomeType
|
||||
where T: Fn(// First arg
|
||||
A,
|
||||
// Second argument
|
||||
B, C, D, /* pre comment */ E /* last comment */) -> &SomeType {
|
||||
arg(a, b, c, d, e)
|
||||
}
|
||||
|
||||
loong_func().quux(move || {
|
||||
if true {
|
||||
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 => (),
|
||||
}
|
||||
});
|
||||
}
|
95
tests/target/hard-tabs.rs
Normal file
95
tests/target/hard-tabs.rs
Normal file
@ -0,0 +1,95 @@
|
||||
// rustfmt-hard_tabs: true
|
||||
|
||||
fn main() {
|
||||
let x = Bar;
|
||||
|
||||
let y = Foo { a: x };
|
||||
|
||||
Foo {
|
||||
a: foo(), // comment
|
||||
// comment
|
||||
b: bar(),
|
||||
..something
|
||||
};
|
||||
|
||||
fn foo(a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32,
|
||||
a: i32) {
|
||||
}
|
||||
|
||||
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAA\
|
||||
AAAAAAAAAAAAaAa";
|
||||
|
||||
if let (some_very_large, tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) =
|
||||
1 + 2 + 3 {
|
||||
}
|
||||
|
||||
if cond() {
|
||||
something();
|
||||
} else if different_cond() {
|
||||
something_else();
|
||||
} else {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
}
|
||||
|
||||
unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
||||
* comment */ {
|
||||
}
|
||||
|
||||
unsafe /* So this is a very long comment.
|
||||
* Multi-line, too.
|
||||
* Will it still format correctly? */ {
|
||||
}
|
||||
|
||||
let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
yyyyyyyyyyyyyyyyyyyyyyyyyyy,
|
||||
zzzzzzzzzzzzzzzzzz,
|
||||
q];
|
||||
|
||||
fn generic<T>(arg: T) -> &SomeType
|
||||
where T: Fn(// First arg
|
||||
A,
|
||||
// Second argument
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
// pre comment
|
||||
E /* last comment */) -> &SomeType
|
||||
{
|
||||
arg(a, b, c, d, e)
|
||||
}
|
||||
|
||||
loong_func().quux(move || {
|
||||
if true {
|
||||
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 => (),
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user