Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd8e3db

Browse files
committed
coverage: Add a specific test for #[rustfmt::skip]
1 parent 4eedad3 commit bd8e3db

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

‎tests/coverage/rustfmt-skip.cov-map

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Function name: rustfmt_skip::main
2+
Raw bytes (24): 0x[01, 01, 00, 04, 01, 0a, 01, 00, 0a, 01, 02, 05, 00, 0d, 01, 03, 09, 00, 10, 01, 02, 01, 00, 02]
3+
Number of files: 1
4+
- file 0 => $DIR/rustfmt-skip.rs
5+
Number of expressions: 0
6+
Number of file 0 mappings: 4
7+
- Code(Counter(0)) at (prev + 10, 1) to (start + 0, 10)
8+
- Code(Counter(0)) at (prev + 2, 5) to (start + 0, 13)
9+
- Code(Counter(0)) at (prev + 3, 9) to (start + 0, 16)
10+
- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
11+
Highest counter ID seen: c0
12+

‎tests/coverage/rustfmt-skip.coverage

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
LL| |//@ edition: 2024
2+
LL| |
3+
LL| |// The presence of `#[rustfmt::skip]` on a function should not cause macros
4+
LL| |// within that function to mysteriously not be instrumented.
5+
LL| |//
6+
LL| |// This test detects problems that can occur when building an expansion tree
7+
LL| |// based on `ExpnData::parent` instead of `ExpnData::call_site`, for example.
8+
LL| |
9+
LL| |#[rustfmt::skip]
10+
LL| 1|fn main() {
11+
LL| | // Ensure a gap between the body start and the first statement.
12+
LL| 1| println!(
13+
LL| | // Keep this on a separate line, to distinguish instrumentation of
14+
LL| | // `println!` from instrumentation of its arguments.
15+
LL| 1| "hello"
16+
LL| | );
17+
LL| 1|}
18+

‎tests/coverage/rustfmt-skip.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ edition: 2024
2+
3+
// The presence of `#[rustfmt::skip]` on a function should not cause macros
4+
// within that function to mysteriously not be instrumented.
5+
//
6+
// This test detects problems that can occur when building an expansion tree
7+
// based on `ExpnData::parent` instead of `ExpnData::call_site`, for example.
8+
9+
#[rustfmt::skip]
10+
fn main() {
11+
// Ensure a gap between the body start and the first statement.
12+
println!(
13+
// Keep this on a separate line, to distinguish instrumentation of
14+
// `println!` from instrumentation of its arguments.
15+
"hello"
16+
);
17+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /