You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This updates the ignore attribute to use the attribute template. This
generally just makes things more explicit, and restructured to follow
the template.
Copy file name to clipboardExpand all lines: src/attributes/testing.md
+38-13Lines changed: 38 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -52,24 +52,49 @@ r[attributes.testing.ignore]
52
52
## The `ignore` attribute
53
53
54
54
r[attributes.testing.ignore.intro]
55
-
A function annotated with the `test` attribute can also be annotated with the
56
-
`ignore` attribute. The *`ignore` attribute* tells the test harness to not
57
-
execute that function as a test. It will still be compiled when in test mode.
55
+
The *`ignore`[attribute][attributes]* can be used with the [`test` attribute][attributes.testing.test] to tell the test harness to not execute that function as a test.
56
+
57
+
> [!EXAMPLE]
58
+
> ```rust
59
+
> #[test]
60
+
> #[ignore]
61
+
> fncheck_thing() {
62
+
> // …
63
+
> }
64
+
> ```
65
+
66
+
> [!NOTE]
67
+
> The `rustc` testharnesssupportsthe `--include-ignored` flagtoforceignoredteststoberun.
58
68
59
69
r[attributes.testing.ignore.syntax]
60
-
The `ignore` attribute may optionally be written with the [MetaNameValueStr]
61
-
syntax to specify a reason why the test is ignored.
70
+
The `ignore` attributeuseseitherthe [MetaWord] or [MetaNameValueStr] syntax.
62
71
63
-
```rust
64
-
#[test]
65
-
#[ignore ="not yet implemented"]
66
-
fnmytest() {
67
-
// …
68
-
}
69
-
```
72
+
r[attributes.testing.ignore.reason]
73
+
The [MetaNameValueStr] formofthe `ignore` attributeprovidesawaytospecifyareasonwhythetestisignored.
74
+
75
+
> [!EXAMPLE]
76
+
> ```rust
77
+
> #[test]
78
+
> #[ignore ="not yet implemented"]
79
+
> fnmytest() {
80
+
> // …
81
+
> }
82
+
> ```
83
+
84
+
r[attributes.testing.ignore.allowed-positions]
85
+
The `ignore` attributemaybeappliedtofunctionsannotatedwiththe `test` attribute.
70
86
71
87
> [!NOTE]
72
-
> The `rustc` test harness supports the `--include-ignored` flag to force ignored tests to be run.
0 commit comments