Skip to content

Commit 2cca97e

Browse files
committed
test(stackable-versioned): add enum example
1 parent 395b16c commit 2cca97e

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

crates/stackable-versioned-macros/tests/attributes.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use stackable_versioned_macros::versioned;
22

33
#[ignore]
44
#[test]
5-
fn pass_container_attributes() {
5+
fn pass_struct_attributes() {
66
/// General struct docs that cover all versions.
77
#[versioned(
88
version(name = "v1alpha1"),
@@ -60,3 +60,47 @@ fn pass_container_attributes() {
6060
quux: String::from("World"),
6161
};
6262
}
63+
64+
#[ignore]
65+
#[allow(dead_code)]
66+
#[test]
67+
fn pass_enum_attributes() {
68+
/// General enum docs that cover all versions.
69+
#[versioned(
70+
version(name = "v1alpha1"),
71+
version(
72+
name = "v1beta1",
73+
doc = r#"
74+
Additional docs for this version which are purposefully long to
75+
show how manual line wrapping works. \
76+
Multi-line docs are also supported, as per regular doc-comments.
77+
"#
78+
),
79+
version(name = "v1beta2"),
80+
version(name = "v1"),
81+
version(name = "v2"),
82+
options(skip(from))
83+
)]
84+
#[derive(Default)]
85+
enum Foo {
86+
/// This variant is available in every version (so far).
87+
#[default]
88+
Foo,
89+
90+
/// Keep the main field docs the same, even after the field is
91+
/// deprecated.
92+
#[versioned(deprecated(since = "v1beta1", note = "gone"))]
93+
DeprecatedBar,
94+
95+
/// This is for baz
96+
#[versioned(added(since = "v1beta1"))]
97+
// Just to check stackable-versioned deprecation warning appears.
98+
// #[deprecated]
99+
Baz,
100+
101+
/// This is will keep changing over time.
102+
#[versioned(renamed(since = "v1beta1", from = "Qoox"))]
103+
#[versioned(renamed(since = "v1", from = "Qaax"))]
104+
Quux,
105+
}
106+
}

0 commit comments

Comments
 (0)