Skip to content

Commit 0399b2f

Browse files
committed
macros: add tests for attribute verification in SerializeRow
They are taken from DeserializeRow.
1 parent 382dc1e commit 0399b2f

File tree

1 file changed

+47
-0
lines changed
  • scylla-cql/src/types/serialize

1 file changed

+47
-0
lines changed

scylla-cql/src/types/serialize/row.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,53 @@ impl<'a> Iterator for SerializedValuesIterator<'a> {
867867
}
868868
}
869869

870+
mod doctests {
871+
872+
/// ```compile_fail
873+
///
874+
/// #[derive(scylla_macros::SerializeRow)]
875+
/// #[scylla(crate = scylla_cql, skip_name_checks)]
876+
/// struct TestRow {}
877+
/// ```
878+
fn _test_struct_deserialization_name_check_skip_requires_enforce_order() {}
879+
880+
/// ```compile_fail
881+
///
882+
/// #[derive(scylla_macros::SerializeRow)]
883+
/// #[scylla(crate = scylla_cql, skip_name_checks)]
884+
/// struct TestRow {
885+
/// #[scylla(rename = "b")]
886+
/// a: i32,
887+
/// }
888+
/// ```
889+
fn _test_struct_deserialization_skip_name_check_conflicts_with_rename() {}
890+
891+
/// ```compile_fail
892+
///
893+
/// #[derive(scylla_macros::SerializeRow)]
894+
/// #[scylla(crate = scylla_cql)]
895+
/// struct TestRow {
896+
/// #[scylla(rename = "b")]
897+
/// a: i32,
898+
/// b: String,
899+
/// }
900+
/// ```
901+
fn _test_struct_deserialization_skip_rename_collision_with_field() {}
902+
903+
/// ```compile_fail
904+
///
905+
/// #[derive(scylla_macros::SerializeRow)]
906+
/// #[scylla(crate = scylla_cql)]
907+
/// struct TestRow {
908+
/// #[scylla(rename = "c")]
909+
/// a: i32,
910+
/// #[scylla(rename = "c")]
911+
/// b: String,
912+
/// }
913+
/// ```
914+
fn _test_struct_deserialization_rename_collision_with_another_rename() {}
915+
}
916+
870917
#[cfg(test)]
871918
mod tests {
872919
use std::borrow::Cow;

0 commit comments

Comments
 (0)