Skip to content

Commit

Permalink
test: add a declaration method conflict to BorshSchema derives
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yf0μl committed Oct 12, 2023
1 parent 3e109ae commit a87d727
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion borsh/tests/test_schema_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ pub fn simple_enum() {
Bacon,
Eggs,
}
assert_eq!("A".to_string(), A::declaration());
// https://github.com/near/borsh-rs/issues/112
#[allow(unused)]
impl A {
pub fn declaration() -> usize {
42
}
}
assert_eq!("A".to_string(), <A as borsh::BorshSchema>::declaration());
let mut defs = Default::default();
A::add_definitions_recursively(&mut defs);
assert_eq!(
Expand Down
10 changes: 9 additions & 1 deletion borsh/tests/test_schema_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ macro_rules! map(
pub fn unit_struct() {
#[derive(borsh::BorshSchema)]
struct A;
assert_eq!("A".to_string(), A::declaration());

// https://github.com/near/borsh-rs/issues/112
#[allow(unused)]
impl A {
pub fn declaration() -> usize {
42
}
}
assert_eq!("A".to_string(), <A as borsh::BorshSchema>::declaration());
let mut defs = Default::default();
A::add_definitions_recursively(&mut defs);
assert_eq!(
Expand Down

0 comments on commit a87d727

Please sign in to comment.