Add some basic tests for chain_width use
This commit is contained in:
parent
78b0728887
commit
58157bb4b7
23
tests/source/configs/chain_width/always.rs
Normal file
23
tests/source/configs/chain_width/always.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// rustfmt-chain_width: 1
|
||||
// setting an unachievable chain_width to always get chains
|
||||
// on separate lines
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should be left alone
|
||||
test.blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp().blorp();
|
||||
test.blorp().blorp().blorp();
|
||||
test.blorp().blorp().blorp().blorp();
|
||||
}
|
23
tests/source/configs/chain_width/small.rs
Normal file
23
tests/source/configs/chain_width/small.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// rustfmt-chain_width: 40
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should not be wrapped
|
||||
test.blorp();
|
||||
test.blorp().blorp();
|
||||
test.blorp().blorp().blorp();
|
||||
test.blorp().blorp().blorp().blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp().blorp().blorp().blorp().blorp();
|
||||
test.blorp().blorp().blorp().blorp().blorp().blorp();
|
||||
}
|
21
tests/source/configs/chain_width/tiny.rs
Normal file
21
tests/source/configs/chain_width/tiny.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// rustfmt-chain_width: 20
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should not be wrapped
|
||||
test.blorp();
|
||||
test.blorp().blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp().blorp().blorp();
|
||||
test.blorp().blorp().blorp().blorp();
|
||||
}
|
29
tests/target/configs/chain_width/always.rs
Normal file
29
tests/target/configs/chain_width/always.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// rustfmt-chain_width: 1
|
||||
// setting an unachievable chain_width to always get chains
|
||||
// on separate lines
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should be left alone
|
||||
test.blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp()
|
||||
.blorp();
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
}
|
32
tests/target/configs/chain_width/small.rs
Normal file
32
tests/target/configs/chain_width/small.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// rustfmt-chain_width: 40
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should not be wrapped
|
||||
test.blorp();
|
||||
test.blorp().blorp();
|
||||
test.blorp().blorp().blorp();
|
||||
test.blorp().blorp().blorp().blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
}
|
26
tests/target/configs/chain_width/tiny.rs
Normal file
26
tests/target/configs/chain_width/tiny.rs
Normal file
@ -0,0 +1,26 @@
|
||||
// rustfmt-chain_width: 20
|
||||
|
||||
struct Fluent {}
|
||||
|
||||
impl Fluent {
|
||||
fn blorp(&self) -> &Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = Fluent {};
|
||||
|
||||
// should not be wrapped
|
||||
test.blorp();
|
||||
test.blorp().blorp();
|
||||
|
||||
// should be wrapped
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
test.blorp()
|
||||
.blorp()
|
||||
.blorp()
|
||||
.blorp();
|
||||
}
|
Loading…
Reference in New Issue
Block a user