From 25bf1741b27ad499800b2c7f7eb26a9d62c97629 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 28 Aug 2017 00:18:17 +0900 Subject: [PATCH] Update tests --- tests/source/attrib.rs | 13 +++++++++++++ tests/source/trait.rs | 4 ++++ tests/target/attrib.rs | 18 ++++++++++++++++-- tests/target/comment.rs | 3 ++- tests/target/comment4.rs | 4 ++-- tests/target/impl.rs | 5 +++++ tests/target/trait.rs | 5 +++++ 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/tests/source/attrib.rs b/tests/source/attrib.rs index 55815371947..fe8a5e3615b 100644 --- a/tests/source/attrib.rs +++ b/tests/source/attrib.rs @@ -1,6 +1,19 @@ // rustfmt-wrap_comments: true // Test attributes and doc comments are preserved. +//! Doc comment + +#![attribute] + +//! Crate doc comment + +// Comment + +// Comment on attribute +#![the(attribute)] + +// Another comment + #[invalid attribute] fn foo() {} diff --git a/tests/source/trait.rs b/tests/source/trait.rs index 57cf4d79954..7ed858a9ca6 100644 --- a/tests/source/trait.rs +++ b/tests/source/trait.rs @@ -53,3 +53,7 @@ trait Ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt where T: Fo trait WhereList where T: Foo, J: Bar {} +trait X /* comment */ {} +trait Y // comment +{ +} diff --git a/tests/target/attrib.rs b/tests/target/attrib.rs index 542ed3676f0..677c920ff1b 100644 --- a/tests/target/attrib.rs +++ b/tests/target/attrib.rs @@ -1,6 +1,19 @@ // rustfmt-wrap_comments: true // Test attributes and doc comments are preserved. +//! Doc comment + +#![attribute] + +//! Crate doc comment + +// Comment + +// Comment on attribute +#![the(attribute)] + +// Another comment + #[invalid attribute] fn foo() {} @@ -33,11 +46,12 @@ pub fn f2(self) { fn f3(self) -> Dog {} /// Blah blah bing. + #[attrib1] /// Blah blah bing. #[attrib2] - // Another comment that needs rewrite because it's - // tooooooooooooooooooooooooooooooo loooooooooooong. + // Another comment that needs rewrite because it's tooooooooooooooooooooooooooooooo + // loooooooooooong. /// Blah blah bing. fn f4(self) -> Cat {} diff --git a/tests/target/comment.rs b/tests/target/comment.rs index 9b650dad51f..168fb28edb9 100644 --- a/tests/target/comment.rs +++ b/tests/target/comment.rs @@ -83,6 +83,7 @@ fn some_fn3() // some comment some comment some comment some comment some commen } fn some_fn4() -// some comment some comment some comment some comment some comment some comment some comment +// some comment some comment some comment some comment some comment some comment +// some comment { } diff --git a/tests/target/comment4.rs b/tests/target/comment4.rs index 516b78c4ec4..2916f083ca0 100644 --- a/tests/target/comment4.rs +++ b/tests/target/comment4.rs @@ -1,5 +1,5 @@ -#![allow(dead_code)] -// bar +#![allow(dead_code)] // bar + //! Doc comment fn test() { // comment diff --git a/tests/target/impl.rs b/tests/target/impl.rs index c0db6769512..7fce1d9dd76 100644 --- a/tests/target/impl.rs +++ b/tests/target/impl.rs @@ -18,6 +18,11 @@ pub fn new(value: V) -> Self { } } +impl X /* comment */ {} +impl Y // comment +{ +} + impl Foo for T // comment1 where diff --git a/tests/target/trait.rs b/tests/target/trait.rs index 199ba2665f2..a2ea54e0f03 100644 --- a/tests/target/trait.rs +++ b/tests/target/trait.rs @@ -79,3 +79,8 @@ trait WhereList J: Bar, { } + +trait X /* comment */ {} +trait Y // comment +{ +}