Skip to content

Commit 2ff2815

Browse files
committed
rustdoc-json: Add tests for #[deprecated(...)]
1 parent 8b87fef commit 2ff2815

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//@ is "$.index[*][?(@.name=='not')].attrs" '[]'
2+
//@ is "$.index[*][?(@.name=='not')].deprecation" null
3+
pub fn not() {}
4+
5+
//@ is "$.index[*][?(@.name=='raw')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]\n"]'
6+
//@ is "$.index[*][?(@.name=='raw')].deprecation" '{"since": null, "note": null}'
7+
#[deprecated]
8+
pub fn raw() {}
9+
10+
//@ is "$.index[*][?(@.name=='equals_string')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:\n\"here is a reason\"}}]\n"]'
11+
//@ is "$.index[*][?(@.name=='equals_string')].deprecation" '{"since": null, "note": "here is a reason"}'
12+
#[deprecated = "here is a reason"]
13+
pub fn equals_string() {}
14+
15+
//@ is "$.index[*][?(@.name=='since')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since:\nNonStandard(\"yoinks ago\")}}]\n"]'
16+
//@ is "$.index[*][?(@.name=='since')].deprecation" '{"since": "yoinks ago", "note": null}'
17+
#[deprecated(since = "yoinks ago")]
18+
pub fn since() {}
19+
20+
//@ is "$.index[*][?(@.name=='note')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:\n\"7\"}}]\n"]'
21+
//@ is "$.index[*][?(@.name=='note')].deprecation" '{"since": null, "note": "7"}'
22+
#[deprecated(note = "7")]
23+
pub fn note() {}
24+
25+
//@ is "$.index[*][?(@.name=='since_and_note')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since:\nNonStandard(\"tomorrow\"), note: \"sorry\"}}]\n"]'
26+
//@ is "$.index[*][?(@.name=='since_and_note')].deprecation" '{"since": "tomorrow", "note": "sorry"}'
27+
#[deprecated(since = "tomorrow", note = "sorry")]
28+
pub fn since_and_note() {}
29+
30+
//@ is "$.index[*][?(@.name=='note_and_since')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since:\nNonStandard(\"a year from tomorrow\"), note: \"your welcome\"}}]\n"]'
31+
//@ is "$.index[*][?(@.name=='note_and_since')].deprecation" '{"since": "a year from tomorrow", "note": "your welcome"}'
32+
#[deprecated(note = "your welcome", since = "a year from tomorrow")]
33+
pub fn note_and_since() {}
34+
35+
//@ is "$.index[*][?(@.name=='neither_but_parens')].attrs" '["#[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]\n"]'
36+
//@ is "$.index[*][?(@.name=='neither_but_parens')].deprecation" '{"since": null, "note": null}'
37+
#[deprecated()]
38+
pub fn neither_but_parens() {}

0 commit comments

Comments
 (0)