Skip to content

Commit

Permalink
fix: Fix Describe syntax comparison tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Jan 6, 2024
1 parent b182d89 commit 7379878
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions radix-engine-derive/src/scrypto_describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ mod tests {
quote! {
impl ::sbor::Describe<radix_engine_common::data::scrypto::ScryptoCustomTypeKind > for MyStruct {
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(MyStruct),
"MyStruct",
&[],
&#code_hash
);
fn type_data() -> ::sbor::TypeData<radix_engine_common::data::scrypto::ScryptoCustomTypeKind, ::sbor::RustTypeId> {
::sbor::TypeData::struct_with_named_fields(
stringify!(MyStruct),
"MyStruct",
::sbor::rust::vec![],
)
}
Expand All @@ -63,13 +63,13 @@ mod tests {
>
{
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Thing),
"Thing",
&[<T>::TYPE_ID,],
&#code_hash
);
fn type_data() -> ::sbor::TypeData<radix_engine_common::data::scrypto::ScryptoCustomTypeKind, ::sbor::RustTypeId> {
::sbor::TypeData::struct_with_named_fields(
stringify!(Thing),
"Thing",
::sbor::rust::vec![
("field", <T as ::sbor::Describe<radix_engine_common::data::scrypto::ScryptoCustomTypeKind >>::TYPE_ID),
],
Expand Down Expand Up @@ -99,14 +99,14 @@ mod tests {
T: ::sbor::Describe<radix_engine_common::data::scrypto::ScryptoCustomTypeKind >
{
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(MyEnum),
"MyEnum",
&[<T>::TYPE_ID,],
&#code_hash
);
fn type_data() -> ::sbor::TypeData<radix_engine_common::data::scrypto::ScryptoCustomTypeKind, ::sbor::RustTypeId> {
use ::sbor::rust::borrow::ToOwned;
::sbor::TypeData::enum_variants(
stringify!(MyEnum),
"MyEnum",
:: sbor :: rust :: prelude :: indexmap ! [
0u8 => :: sbor :: TypeData :: struct_with_named_fields ("A", :: sbor :: rust :: vec ! [("named", < T as :: sbor :: Describe < radix_engine_common::data::scrypto::ScryptoCustomTypeKind >> :: TYPE_ID) ,] ,) ,
1u8 => :: sbor :: TypeData :: struct_with_unnamed_fields ("B", :: sbor :: rust :: vec ! [< String as :: sbor :: Describe < radix_engine_common::data::scrypto::ScryptoCustomTypeKind >> :: TYPE_ID ,] ,) ,
Expand Down
20 changes: 10 additions & 10 deletions sbor-derive-common/src/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ mod tests {
quote! {
impl <C: ::sbor::CustomTypeKind<::sbor::RustTypeId> > ::sbor::Describe<C> for Test {
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Test),
"Test",
&[],
&#code_hash
);

fn type_data() -> ::sbor::TypeData <C, ::sbor::RustTypeId> {
::sbor::TypeData::struct_with_named_fields(
stringify!(Test),
"Test",
::sbor::rust::vec![
("a", <u32 as ::sbor::Describe<C>>::TYPE_ID),
("b", <Vec<u8> as ::sbor::Describe<C>>::TYPE_ID),
Expand Down Expand Up @@ -359,7 +359,7 @@ mod tests {
for Test
{
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Test),
"Test",
&[],
&#code_hash
);
Expand All @@ -368,7 +368,7 @@ mod tests {
radix_engine_interface::data::ScryptoCustomTypeKind<::sbor::RustTypeId>,
::sbor::RustTypeId> {
::sbor::TypeData::struct_with_named_fields(
stringify!(Test),
"Test",
::sbor::rust::vec![
(
"a",
Expand Down Expand Up @@ -415,14 +415,14 @@ mod tests {
quote! {
impl <C: ::sbor::CustomTypeKind<::sbor::RustTypeId> > ::sbor::Describe<C> for Test {
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Test),
"Test",
&[],
&#code_hash
);

fn type_data() -> ::sbor::TypeData <C, ::sbor::RustTypeId> {
::sbor::TypeData::struct_with_unnamed_fields(
stringify!(Test),
"Test",
::sbor::rust::vec![
<u32 as ::sbor::Describe<C>>::TYPE_ID,
<Vec<u8> as ::sbor::Describe<C>>::TYPE_ID,
Expand Down Expand Up @@ -451,13 +451,13 @@ mod tests {
quote! {
impl <C: ::sbor::CustomTypeKind<::sbor::RustTypeId> > ::sbor::Describe<C> for Test {
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Test),
"Test",
&[],
&#code_hash
);

fn type_data() -> ::sbor::TypeData <C, ::sbor::RustTypeId> {
::sbor::TypeData::struct_with_unit_fields(stringify!(Test))
::sbor::TypeData::struct_with_unit_fields("Test")
}
}
},
Expand All @@ -480,15 +480,15 @@ mod tests {
T2: ::sbor::Describe<C>
{
const TYPE_ID: ::sbor::RustTypeId = ::sbor::RustTypeId::novel_with_code(
stringify!(Test),
"Test",
&[<T>::TYPE_ID, <T2>::TYPE_ID,],
&#code_hash
);

fn type_data() -> ::sbor::TypeData <C, ::sbor::RustTypeId> {
use ::sbor::rust::borrow::ToOwned;
::sbor::TypeData::enum_variants(
stringify!(Test),
"Test",
::sbor::rust::prelude::indexmap![
0u8 => ::sbor::TypeData::struct_with_unit_fields("A"),
1u8 => ::sbor::TypeData::struct_with_unnamed_fields(
Expand Down

0 comments on commit 7379878

Please sign in to comment.