From d23628c91b84b49f2c66e86d4f7fd6670a300064 Mon Sep 17 00:00:00 2001 From: Jeremy Wazny Date: Tue, 26 Jan 2016 16:55:51 +1100 Subject: [PATCH] Added tests. --- tests/source/where-trailing-comma.rs | 37 ++++++++++++++++++ tests/target/where-trailing-comma.rs | 57 ++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/source/where-trailing-comma.rs create mode 100644 tests/target/where-trailing-comma.rs diff --git a/tests/source/where-trailing-comma.rs b/tests/source/where-trailing-comma.rs new file mode 100644 index 00000000000..8f951d199e4 --- /dev/null +++ b/tests/source/where-trailing-comma.rs @@ -0,0 +1,37 @@ +// rustfmt-where_trailing_comma: true + +fn f(x: T, y: S) -> T where T: P, S: Q +{ + x +} + +impl Trait for T where T: P +{ + fn f(x: T) -> T where T: Q + R + { + x + } +} + +struct Pair where T: P, S: P + Q { + a: T, + b: S +} + +struct TupPair (S, T) where T: P, S: P + Q; + +enum E where S: P, T: P { + A {a: T}, +} + +type Double where T: P, T: Q = Pair; + +extern "C" { + fn f(x: T, y: S) -> T where T: P, S: Q; +} + +// Note: trait declarations are not fully formatted (issue #78) +trait Q where T: P, S: R +{ + fn f(self, x: T, y: S, z: U) -> Self where U: P, V: P; +} diff --git a/tests/target/where-trailing-comma.rs b/tests/target/where-trailing-comma.rs new file mode 100644 index 00000000000..bd7108f992a --- /dev/null +++ b/tests/target/where-trailing-comma.rs @@ -0,0 +1,57 @@ +// rustfmt-where_trailing_comma: true + +fn f(x: T, y: S) -> T + where T: P, + S: Q, +{ + x +} + +impl Trait for T + where T: P, +{ + fn f(x: T) -> T + where T: Q + R, + { + x + } +} + +struct Pair + where T: P, + S: P + Q, +{ + a: T, + b: S, +} + +struct TupPair(S, T) + where T: P, + S: P + Q; + +enum E + where S: P, + T: P, +{ + A { + a: T, + }, +} + +type Double + where T: P, + T: Q = Pair; + +extern "C" { + fn f(x: T, y: S) -> T + where T: P, + S: Q; +} + +// Note: trait declarations are not fully formatted (issue #78) +trait Q where T: P, S: R +{ + fn f(self, x: T, y: S, z: U) -> Self + where U: P, + V: P; +}