-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add insta
snapshots to borsh/tests
#157
Conversation
d28d93f
to
6a31c3c
Compare
insta
snapshots to borsh/testsinsta
snapshots to borsh/tests
e223169
to
148ab11
Compare
insta
snapshots to borsh/testsinsta
snapshots to borsh/tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dj8yfo Looks good to me! Let's rebase/resolve merge conflict and address the only comment I left before merging.
borsh/tests/test_schema_enums.rs
Outdated
@@ -148,6 +148,7 @@ pub fn complex_enum_with_schema() { | |||
// Then check that we serialize and deserialize with schema. | |||
let obj = A::default(); | |||
let data = try_to_vec_with_schema(&obj).unwrap(); | |||
// insta::assert_debug_snapshot!(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it commented out? Is it too big? Is it not stable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've mentioned that this example of schema derivation https://github.com/near/borsh-rs/blob/master/borsh-schema-derive-internal/src/enum_schema.rs#L365 is suboptimal, as structs representing enum variants depend on more generic params than their counterparts in original enum.
There may be more of such details, which would affect schema serialization if changed.
148ab11
to
e6a5507
Compare
c59dfe5
to
e8a519f
Compare
#[cfg(feature = "std")] | ||
insta::assert_debug_snapshot!(encoded_a); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pity that we skip the format safety checks for no-std. Is there anything we can do about it? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, not with insta
crate . it explicitly imports std
in expanded macros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://crates.io/crates/expect-test and https://crates.io/crates/k9 and don't feature no_std
as far as i can see as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's live with this for now. Maybe someone will contribute no_std support to insta or some other similar tool.
Resolves #152