From 2376582dfb7d2523384dc8618d23c7bf61d8d2c8 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Fri, 11 Aug 2017 17:54:20 +0900 Subject: [PATCH] Update tests --- tests/source/enum.rs | 13 +++++++++++ tests/target/attrib.rs | 3 +-- ...configs-struct_field_align_threshold-20.rs | 3 +-- tests/target/enum.rs | 22 ++++++++++++++----- tests/target/macros.rs | 5 ++++- tests/target/struct-field-attributes.rs | 6 ++--- tests/target/structs.rs | 3 +-- tests/target/unions.rs | 3 +-- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/tests/source/enum.rs b/tests/source/enum.rs index 7b9bf4ec0c5..48d34b9a396 100644 --- a/tests/source/enum.rs +++ b/tests/source/enum.rs @@ -125,3 +125,16 @@ enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo enum Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong {} enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong {} enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong { Foo } + +// #1046 +pub enum Entry<'a, K: 'a, V: 'a> { + // This attribute should stay on the same line. + Vacant( + #[ stable( feature = "rust1", since = "1.0.0" ) ] VacantEntry<'a, K, V>, + ), + // This attribute should be kept on the previous line. + Occupied( + #[ stable( feature = "rust1", since = "1.0.0" ) ] + OccupiedEntry<'a, K, V>, + ), +} diff --git a/tests/target/attrib.rs b/tests/target/attrib.rs index 43283d2db05..fc2dfc11ad9 100644 --- a/tests/target/attrib.rs +++ b/tests/target/attrib.rs @@ -45,8 +45,7 @@ impl Bar { // #984 struct Foo { - #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] - foo: usize, + #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] foo: usize, } // #1668 diff --git a/tests/target/configs-struct_field_align_threshold-20.rs b/tests/target/configs-struct_field_align_threshold-20.rs index 08210b2ee3c..da933a75c7d 100644 --- a/tests/target/configs-struct_field_align_threshold-20.rs +++ b/tests/target/configs-struct_field_align_threshold-20.rs @@ -40,8 +40,7 @@ pub struct Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] - g: SomeOtherType, + #[AnAttribute] g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField, diff --git a/tests/target/enum.rs b/tests/target/enum.rs index e87fcf9a7f7..c363aca59b2 100644 --- a/tests/target/enum.rs +++ b/tests/target/enum.rs @@ -24,8 +24,7 @@ enum EmtpyWithComment { // C-style enum enum Bar { A = 1, - #[someAttr(test)] - B = 2, // comment + #[someAttr(test)] B = 2, // comment C, } @@ -43,8 +42,7 @@ enum StructLikeVariants { StructLike { x: i32, // Test comment // Pre-comment - #[Attr50] - y: SomeType, // Aanother Comment + #[Attr50] y: SomeType, // Aanother Comment }, SL { a: A }, } @@ -98,7 +96,7 @@ enum EmtpyWithComment { } enum TestFormatFails { - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, } fn nested_enum_test() { @@ -127,7 +125,7 @@ fn nested_enum_test() { * AAAAAAAAAAAAAAAAAA */ } enum TestNestedFormatFail { - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, } } } @@ -169,3 +167,15 @@ enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { Foo, } + +// #1046 +pub enum Entry<'a, K: 'a, V: 'a> { + // This attribute should stay on the same line. + Vacant( + #[stable(feature = "rust1", since = "1.0.0")] VacantEntry<'a, K, V>, + ), + // This attribute should be kept on the previous line. + Occupied( + #[stable(feature = "rust1", since = "1.0.0")] OccupiedEntry<'a, K, V>, + ), +} diff --git a/tests/target/macros.rs b/tests/target/macros.rs index 392a190ff0c..f80f6843fe2 100644 --- a/tests/target/macros.rs +++ b/tests/target/macros.rs @@ -141,7 +141,10 @@ fn issue1178() { (#[$attr:meta] $name:ident) => {} } - foo!(#[doc = "bar"] baz); + foo!( + #[doc = "bar"] + baz + ); } fn issue1739() { sql_function!( diff --git a/tests/target/struct-field-attributes.rs b/tests/target/struct-field-attributes.rs index 8ae40ac9bdf..0a863ca4979 100644 --- a/tests/target/struct-field-attributes.rs +++ b/tests/target/struct-field-attributes.rs @@ -4,8 +4,7 @@ struct Foo { bar: u64, - #[cfg(test)] - qux: u64, + #[cfg(test)] qux: u64, } fn do_something() -> Foo { @@ -24,8 +23,7 @@ fn main() { // #1462 struct Foo { foo: usize, - #[cfg(feature = "include-bar")] - bar: usize, + #[cfg(feature = "include-bar")] bar: usize, } fn new_foo() -> Foo { diff --git a/tests/target/structs.rs b/tests/target/structs.rs index 945eb683f60..a4c26269f8e 100644 --- a/tests/target/structs.rs +++ b/tests/target/structs.rs @@ -8,8 +8,7 @@ pub struct Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] - g: SomeOtherType, + #[AnAttribute] g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField, diff --git a/tests/target/unions.rs b/tests/target/unions.rs index bd6328173b5..cff00d064ff 100644 --- a/tests/target/unions.rs +++ b/tests/target/unions.rs @@ -8,8 +8,7 @@ pub union Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] - g: SomeOtherType, + #[AnAttribute] g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField,