diff options
Diffstat (limited to 'log_db/tests/integration.rs')
| -rw-r--r-- | log_db/tests/integration.rs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/log_db/tests/integration.rs b/log_db/tests/integration.rs index 3d71279..af12fb4 100644 --- a/log_db/tests/integration.rs +++ b/log_db/tests/integration.rs @@ -36,6 +36,22 @@ enum Field { Data, } +impl AsRef<str> for Field { + fn as_ref(&self) -> &str { + match self { + Field::Id => "id", + Field::Name => "name", + Field::Data => "data", + } + } +} + +impl Into<String> for Field { + fn into(self) -> String { + self.as_ref().to_owned() + } +} + #[derive(Debug)] struct Inst { pub id: i64, @@ -610,7 +626,7 @@ fn test_batch_find_by() { } let batch: Vec<Value> = (2..5).map(Value::Int).collect(); - let result = db.batch_find_by(&Field::Id, &batch).unwrap(); + let result = db.batch_find_by(Field::Id, &batch).unwrap(); assert_eq!(result.len(), batch.len()); assert_eq!( @@ -707,6 +723,23 @@ enum FieldWithNewNullableField { MaybeStr, } +impl AsRef<str> for FieldWithNewNullableField { + fn as_ref(&self) -> &str { + match self { + FieldWithNewNullableField::Id => "id", + FieldWithNewNullableField::Name => "name", + FieldWithNewNullableField::Data => "data", + FieldWithNewNullableField::MaybeStr => "maybe_str", + } + } +} + +impl Into<String> for FieldWithNewNullableField { + fn into(self) -> String { + self.as_ref().to_owned() + } +} + struct InstWithNewNullableField { pub id: i64, pub name: Option<String>, |
