Skip to content

Commit aff5eed

Browse files
authored
chore(test): Follow naming convention of type (#1841)
1 parent 3a16662 commit aff5eed

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

tonic/src/metadata/value.rs

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -830,85 +830,85 @@ fn test_from_shared_base64_encodes() {
830830

831831
#[test]
832832
fn test_value_eq_value() {
833-
type BMV = BinaryMetadataValue;
834-
type AMV = AsciiMetadataValue;
833+
type Bmv = BinaryMetadataValue;
834+
type Amv = AsciiMetadataValue;
835835

836-
assert_eq!(AMV::from_static("abc"), AMV::from_static("abc"));
837-
assert_ne!(AMV::from_static("abc"), AMV::from_static("ABC"));
836+
assert_eq!(Amv::from_static("abc"), Amv::from_static("abc"));
837+
assert_ne!(Amv::from_static("abc"), Amv::from_static("ABC"));
838838

839-
assert_eq!(BMV::from_bytes(b"abc"), BMV::from_bytes(b"abc"));
840-
assert_ne!(BMV::from_bytes(b"abc"), BMV::from_bytes(b"ABC"));
839+
assert_eq!(Bmv::from_bytes(b"abc"), Bmv::from_bytes(b"abc"));
840+
assert_ne!(Bmv::from_bytes(b"abc"), Bmv::from_bytes(b"ABC"));
841841

842842
// Padding is ignored.
843843
assert_eq!(
844-
BMV::from_static("SGVsbG8hIQ=="),
845-
BMV::from_static("SGVsbG8hIQ")
844+
Bmv::from_static("SGVsbG8hIQ=="),
845+
Bmv::from_static("SGVsbG8hIQ")
846846
);
847847
// Invalid values are all just invalid from this point of view.
848848
unsafe {
849849
assert_eq!(
850-
BMV::from_shared_unchecked(Bytes::from_static(b"..{}")),
851-
BMV::from_shared_unchecked(Bytes::from_static(b"{}.."))
850+
Bmv::from_shared_unchecked(Bytes::from_static(b"..{}")),
851+
Bmv::from_shared_unchecked(Bytes::from_static(b"{}.."))
852852
);
853853
}
854854
}
855855

856856
#[test]
857857
fn test_value_eq_str() {
858-
type BMV = BinaryMetadataValue;
859-
type AMV = AsciiMetadataValue;
858+
type Bmv = BinaryMetadataValue;
859+
type Amv = AsciiMetadataValue;
860860

861-
assert_eq!(AMV::from_static("abc"), "abc");
862-
assert_ne!(AMV::from_static("abc"), "ABC");
863-
assert_eq!("abc", AMV::from_static("abc"));
864-
assert_ne!("ABC", AMV::from_static("abc"));
861+
assert_eq!(Amv::from_static("abc"), "abc");
862+
assert_ne!(Amv::from_static("abc"), "ABC");
863+
assert_eq!("abc", Amv::from_static("abc"));
864+
assert_ne!("ABC", Amv::from_static("abc"));
865865

866-
assert_eq!(BMV::from_bytes(b"abc"), "abc");
867-
assert_ne!(BMV::from_bytes(b"abc"), "ABC");
868-
assert_eq!("abc", BMV::from_bytes(b"abc"));
869-
assert_ne!("ABC", BMV::from_bytes(b"abc"));
866+
assert_eq!(Bmv::from_bytes(b"abc"), "abc");
867+
assert_ne!(Bmv::from_bytes(b"abc"), "ABC");
868+
assert_eq!("abc", Bmv::from_bytes(b"abc"));
869+
assert_ne!("ABC", Bmv::from_bytes(b"abc"));
870870

871871
// Padding is ignored.
872-
assert_eq!(BMV::from_static("SGVsbG8hIQ=="), "Hello!!");
873-
assert_eq!("Hello!!", BMV::from_static("SGVsbG8hIQ=="));
872+
assert_eq!(Bmv::from_static("SGVsbG8hIQ=="), "Hello!!");
873+
assert_eq!("Hello!!", Bmv::from_static("SGVsbG8hIQ=="));
874874
}
875875

876876
#[test]
877877
fn test_value_eq_bytes() {
878-
type BMV = BinaryMetadataValue;
879-
type AMV = AsciiMetadataValue;
878+
type Bmv = BinaryMetadataValue;
879+
type Amv = AsciiMetadataValue;
880880

881-
assert_eq!(AMV::from_static("abc"), "abc".as_bytes());
882-
assert_ne!(AMV::from_static("abc"), "ABC".as_bytes());
883-
assert_eq!(*"abc".as_bytes(), AMV::from_static("abc"));
884-
assert_ne!(*"ABC".as_bytes(), AMV::from_static("abc"));
881+
assert_eq!(Amv::from_static("abc"), "abc".as_bytes());
882+
assert_ne!(Amv::from_static("abc"), "ABC".as_bytes());
883+
assert_eq!(*"abc".as_bytes(), Amv::from_static("abc"));
884+
assert_ne!(*"ABC".as_bytes(), Amv::from_static("abc"));
885885

886-
assert_eq!(*"abc".as_bytes(), BMV::from_bytes(b"abc"));
887-
assert_ne!(*"ABC".as_bytes(), BMV::from_bytes(b"abc"));
886+
assert_eq!(*"abc".as_bytes(), Bmv::from_bytes(b"abc"));
887+
assert_ne!(*"ABC".as_bytes(), Bmv::from_bytes(b"abc"));
888888

889889
// Padding is ignored.
890-
assert_eq!(BMV::from_static("SGVsbG8hIQ=="), "Hello!!".as_bytes());
891-
assert_eq!(*"Hello!!".as_bytes(), BMV::from_static("SGVsbG8hIQ=="));
890+
assert_eq!(Bmv::from_static("SGVsbG8hIQ=="), "Hello!!".as_bytes());
891+
assert_eq!(*"Hello!!".as_bytes(), Bmv::from_static("SGVsbG8hIQ=="));
892892
}
893893

894894
#[test]
895895
fn test_ascii_value_hash() {
896896
use std::collections::hash_map::DefaultHasher;
897-
type AMV = AsciiMetadataValue;
897+
type Amv = AsciiMetadataValue;
898898

899-
fn hash(value: AMV) -> u64 {
899+
fn hash(value: Amv) -> u64 {
900900
let mut hasher = DefaultHasher::new();
901901
value.hash(&mut hasher);
902902
hasher.finish()
903903
}
904904

905-
let value1 = AMV::from_static("abc");
906-
let value2 = AMV::from_static("abc");
905+
let value1 = Amv::from_static("abc");
906+
let value2 = Amv::from_static("abc");
907907
assert_eq!(value1, value2);
908908
assert_eq!(hash(value1), hash(value2));
909909

910-
let value1 = AMV::from_static("abc");
911-
let value2 = AMV::from_static("xyz");
910+
let value1 = Amv::from_static("abc");
911+
let value2 = Amv::from_static("xyz");
912912

913913
assert_ne!(value1, value2);
914914
assert_ne!(hash(value1), hash(value2));
@@ -917,46 +917,46 @@ fn test_ascii_value_hash() {
917917
#[test]
918918
fn test_valid_binary_value_hash() {
919919
use std::collections::hash_map::DefaultHasher;
920-
type BMV = BinaryMetadataValue;
920+
type Bmv = BinaryMetadataValue;
921921

922-
fn hash(value: BMV) -> u64 {
922+
fn hash(value: Bmv) -> u64 {
923923
let mut hasher = DefaultHasher::new();
924924
value.hash(&mut hasher);
925925
hasher.finish()
926926
}
927927

928-
let value1 = BMV::from_bytes(b"abc");
929-
let value2 = BMV::from_bytes(b"abc");
928+
let value1 = Bmv::from_bytes(b"abc");
929+
let value2 = Bmv::from_bytes(b"abc");
930930
assert_eq!(value1, value2);
931931
assert_eq!(hash(value1), hash(value2));
932932

933-
let value1 = BMV::from_bytes(b"abc");
934-
let value2 = BMV::from_bytes(b"xyz");
933+
let value1 = Bmv::from_bytes(b"abc");
934+
let value2 = Bmv::from_bytes(b"xyz");
935935
assert_ne!(value1, value2);
936936
assert_ne!(hash(value1), hash(value2));
937937
}
938938

939939
#[test]
940940
fn test_invalid_binary_value_hash() {
941941
use std::collections::hash_map::DefaultHasher;
942-
type BMV = BinaryMetadataValue;
942+
type Bmv = BinaryMetadataValue;
943943

944-
fn hash(value: BMV) -> u64 {
944+
fn hash(value: Bmv) -> u64 {
945945
let mut hasher = DefaultHasher::new();
946946
value.hash(&mut hasher);
947947
hasher.finish()
948948
}
949949

950950
unsafe {
951-
let value1 = BMV::from_shared_unchecked(Bytes::from_static(b"..{}"));
952-
let value2 = BMV::from_shared_unchecked(Bytes::from_static(b"{}.."));
951+
let value1 = Bmv::from_shared_unchecked(Bytes::from_static(b"..{}"));
952+
let value2 = Bmv::from_shared_unchecked(Bytes::from_static(b"{}.."));
953953
assert_eq!(value1, value2);
954954
assert_eq!(hash(value1), hash(value2));
955955
}
956956

957957
unsafe {
958-
let valid = BMV::from_bytes(b"abc");
959-
let invalid = BMV::from_shared_unchecked(Bytes::from_static(b"{}.."));
958+
let valid = Bmv::from_bytes(b"abc");
959+
let invalid = Bmv::from_shared_unchecked(Bytes::from_static(b"{}.."));
960960
assert_ne!(valid, invalid);
961961
assert_ne!(hash(valid), hash(invalid));
962962
}

0 commit comments

Comments
 (0)