feat(macros): enhance Integrable derive with validation and versioning improvements
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#[derive(arbiter_macros::Hashable, arbiter_macros::Integrable)]
|
||||
#[integrable(kind = "entity_a")]
|
||||
#[integrable(kind = "entity_b")]
|
||||
struct DuplicateAttr {
|
||||
value: i32,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: duplicate #[integrable] attribute
|
||||
--> tests/ui/integrable/duplicate_attr.rs:3:1
|
||||
|
|
||||
3 | #[integrable(kind = "entity_b")]
|
||||
| ^
|
||||
@@ -0,0 +1,7 @@
|
||||
#[derive(arbiter_macros::Hashable, arbiter_macros::Integrable)]
|
||||
#[integrable(kind = "")]
|
||||
struct EmptyKind {
|
||||
value: i32,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: kind must not be empty
|
||||
--> tests/ui/integrable/empty_kind.rs:2:21
|
||||
|
|
||||
2 | #[integrable(kind = "")]
|
||||
| ^^
|
||||
@@ -0,0 +1,8 @@
|
||||
#[derive(arbiter_macros::Integrable)]
|
||||
#[integrable(kind = "my_enum")]
|
||||
enum MyEnum {
|
||||
A,
|
||||
B,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: #[derive(Integrable)] is only supported on structs
|
||||
--> tests/ui/integrable/enum_not_supported.rs:3:6
|
||||
|
|
||||
3 | enum MyEnum {
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,7 @@
|
||||
#[derive(arbiter_macros::Hashable, arbiter_macros::Integrable)]
|
||||
#[integrable(kind = "bad kind!")]
|
||||
struct InvalidKind {
|
||||
value: i32,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: kind must be a valid schema name: start with a letter, contain only [a-zA-Z0-9_]
|
||||
--> tests/ui/integrable/invalid_kind.rs:2:21
|
||||
|
|
||||
2 | #[integrable(kind = "bad kind!")]
|
||||
| ^^^^^^^^^^^
|
||||
@@ -0,0 +1,6 @@
|
||||
#[derive(arbiter_macros::Hashable, arbiter_macros::Integrable)]
|
||||
struct MissingAttr {
|
||||
value: i32,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: #[integrable(kind = "...")] is required
|
||||
--> tests/ui/integrable/missing_attr.rs:2:8
|
||||
|
|
||||
2 | struct MissingAttr {
|
||||
| ^^^^^^^^^^^
|
||||
Reference in New Issue
Block a user