Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 171e656

Browse files
committed
add non-regression test to existing attributes
when `normalize_doc_attributes` is on, they shouldn't be affected
1 parent 4af0888 commit 171e656

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

tests/source/doc-attrib.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,53 @@ mod tests {
2323
}
2424
}
2525
}
26+
27+
// non-regression test for regular attributes, from #2647
28+
#[cfg(feature = "this_line_is_101_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")]
29+
pub fn foo() {}
30+
31+
// path attrs
32+
#[clippy::bar]
33+
#[clippy::bar=foo]
34+
#[clippy::bar(a, b, c)]
35+
pub fn foo() {}
36+
37+
mod issue_2620 {
38+
#[derive(Debug, StructOpt)]
39+
#[structopt(about = "Display information about the character on FF Logs")]
40+
pub struct Params {
41+
#[structopt(help = "The server the character is on")]
42+
server: String,
43+
#[structopt(help = "The character's first name")]
44+
first_name: String,
45+
#[structopt(help = "The character's last name")]
46+
last_name: String,
47+
#[structopt(
48+
short = "j",
49+
long = "job",
50+
help = "The job to look at",
51+
parse(try_from_str)
52+
)]
53+
job: Option<Job>
54+
}
55+
}
56+
57+
// non-regression test for regular attributes, from #2969
58+
#[cfg(not(all(feature="std",
59+
any(target_os = "linux", target_os = "android",
60+
target_os = "netbsd",
61+
target_os = "dragonfly",
62+
target_os = "haiku",
63+
target_os = "emscripten",
64+
target_os = "solaris",
65+
target_os = "cloudabi",
66+
target_os = "macos", target_os = "ios",
67+
target_os = "freebsd",
68+
target_os = "openbsd", target_os = "bitrig",
69+
target_os = "redox",
70+
target_os = "fuchsia",
71+
windows,
72+
all(target_arch = "wasm32", feature = "stdweb"),
73+
all(target_arch = "wasm32", feature = "wasm-bindgen"),
74+
))))]
75+
type Os = NoSource;

tests/target/doc-attrib.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,61 @@ mod tests {
2727
}
2828
}
2929
}
30+
31+
// non-regression test for regular attributes, from #2647
32+
#[cfg(
33+
feature = "this_line_is_101_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
34+
)]
35+
pub fn foo() {}
36+
37+
// path attrs
38+
#[clippy::bar]
39+
#[clippy::bar=foo]
40+
#[clippy::bar(a, b, c)]
41+
pub fn foo() {}
42+
43+
mod issue_2620 {
44+
#[derive(Debug, StructOpt)]
45+
#[structopt(about = "Display information about the character on FF Logs")]
46+
pub struct Params {
47+
#[structopt(help = "The server the character is on")]
48+
server: String,
49+
#[structopt(help = "The character's first name")]
50+
first_name: String,
51+
#[structopt(help = "The character's last name")]
52+
last_name: String,
53+
#[structopt(
54+
short = "j",
55+
long = "job",
56+
help = "The job to look at",
57+
parse(try_from_str)
58+
)]
59+
job: Option<Job>,
60+
}
61+
}
62+
63+
// non-regression test for regular attributes, from #2969
64+
#[cfg(not(all(
65+
feature = "std",
66+
any(
67+
target_os = "linux",
68+
target_os = "android",
69+
target_os = "netbsd",
70+
target_os = "dragonfly",
71+
target_os = "haiku",
72+
target_os = "emscripten",
73+
target_os = "solaris",
74+
target_os = "cloudabi",
75+
target_os = "macos",
76+
target_os = "ios",
77+
target_os = "freebsd",
78+
target_os = "openbsd",
79+
target_os = "bitrig",
80+
target_os = "redox",
81+
target_os = "fuchsia",
82+
windows,
83+
all(target_arch = "wasm32", feature = "stdweb"),
84+
all(target_arch = "wasm32", feature = "wasm-bindgen"),
85+
)
86+
)))]
87+
type Os = NoSource;

0 commit comments

Comments
 (0)