diff options
Diffstat (limited to 'rust-bindings/src/tests/collection_ref.rs')
-rw-r--r-- | rust-bindings/src/tests/collection_ref.rs | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/rust-bindings/src/tests/collection_ref.rs b/rust-bindings/src/tests/collection_ref.rs index b6bf050e..515bd385 100644 --- a/rust-bindings/src/tests/collection_ref.rs +++ b/rust-bindings/src/tests/collection_ref.rs @@ -12,68 +12,62 @@ fn hash(v: &impl Hash) -> u64 { #[test] fn same_value_should_be_equal() { - let r = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); + let r = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); assert_eq!(r, r); } #[test] fn equal_values_should_be_equal() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); - let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); + let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); assert_eq!(a, b); } #[test] fn equal_values_without_collection_id_should_be_equal() { - let a = CollectionRef::new(None, "ref-name").unwrap(); - let b = CollectionRef::new(None, "ref-name").unwrap(); + let a = CollectionRef::new(None, "ref-name"); + let b = CollectionRef::new(None, "ref-name"); assert_eq!(a, b); } #[test] fn different_values_should_not_be_equal() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref1").unwrap(); - let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref2").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref1"); + let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref2"); assert_ne!(a, b); } #[test] -fn new_with_invalid_collection_id_should_return_none() { - let r = CollectionRef::new(Some(".abc"), "ref"); - assert_eq!(r, None); -} - -#[test] fn hash_for_equal_values_should_be_equal() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); - let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); + let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); assert_eq!(hash(&a), hash(&b)); } #[test] fn hash_for_values_with_different_collection_id_should_be_different() { - let a = CollectionRef::new(Some("io.gitlab.fkrull1"), "ref").unwrap(); - let b = CollectionRef::new(Some("io.gitlab.fkrull2"), "ref").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull1"), "ref"); + let b = CollectionRef::new(Some("io.gitlab.fkrull2"), "ref"); assert_ne!(hash(&a), hash(&b)); } #[test] fn hash_for_values_with_different_ref_id_should_be_different() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-1").unwrap(); - let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-2").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-1"); + let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-2"); assert_ne!(hash(&a), hash(&b)); } #[test] fn hash_should_be_different_if_collection_id_is_absent() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); - let b = CollectionRef::new(None, "ref").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); + let b = CollectionRef::new(None, "ref"); assert_ne!(hash(&a), hash(&b)); } #[test] fn clone_should_be_equal_to_original_value() { - let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap(); + let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref"); let b = a.clone(); assert_eq!(a, b); } |