Skip to content

Commit

Permalink
test(property): required to be used on property if no default accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogay committed Feb 2, 2022
1 parent 3416667 commit fa0d2c4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gdnative-derive/src/native_script.rs
Expand Up @@ -440,4 +440,22 @@ mod tests {
let input: DeriveInput = syn::parse2(input).unwrap();
parse_derive_input(&input).unwrap();
}

#[test]
fn derive_property_require_to_be_used_on_property_without_default_accessor() {
let input: TokenStream2 = syn::parse_str(
r#"
#[inherit(Node)]
struct Foo {
#[property(get = "Self::get_bar", set = "Self::set_bar")]
bar: i64,
}"#,
)
.unwrap();
let input: DeriveInput = syn::parse2(input).unwrap();
assert_eq!(
derive_native_class(&input).unwrap_err().to_string(),
"The `property` attribute can only be used on `Property` if none of the default logic is used.".to_string(),
);
}
}

0 comments on commit fa0d2c4

Please sign in to comment.