martin-g commented on code in PR #401:
URL: https://github.com/apache/avro-rs/pull/401#discussion_r2692158899
##########
avro_derive/tests/derive.rs:
##########
@@ -1827,3 +1827,88 @@ fn avro_rs_247_serde_flatten_support_with_skip() {
b: 321,
});
}
+
+#[test]
+fn avro_rs_401_do_not_match_typename() {
+ #[expect(nonstandard_style, reason = "It needs to be exactly this")]
+ type f32 = f64;
+
+ #[expect(dead_code, reason = "We only check the schema")]
+ #[derive(AvroSchema)]
+ struct Foo {
+ field: f32,
+ }
+
+ let schema = r#"
+ {
+ "type":"record",
+ "name":"Foo",
+ "fields": [
+ {
+ "name":"field",
+ "type":"double"
+ }
+ ]
+ }
+ "#;
+
+ let schema = Schema::parse_str(schema).unwrap();
+ assert_eq!(schema, Foo::get_schema());
+}
+
+#[test]
+fn avro_rs_401_supported_type_variants() {
+ #[expect(dead_code, reason = "We only check the schema")]
+ #[derive(AvroSchema)]
+ struct Foo<'a> {
+ one: f32,
+ two: std::string::String,
+ three: &'static i32,
+ four: &'a str,
+ five: &'a mut f64,
+ six: [u8; 5],
+ seven: [u8],
Review Comment:
And how one sets a value for such field ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]